Advent Of Code Runner by Fatboychummy
Fixed installation, unified libraries into the single file. This will be changed later during the rewrite, but this fixes installation for now.
This is a program I started last year. It's main use is to make working with Advent of Code in CC/CraftOS-PC a little bit easier.
I plan in future to redo this entire thing (since it was made a little bit before I changed a lot of my coding standards), and implement automatic parsing of the challenge page as well (so the README.md
and test_input.txt
files can be auto-populated).
Features
Simple selection of which puzzle to run
To run a specific challenge, simply run
challenge year day challenge_number
i.e:
challenge 2023 3 1
Automatically grab your puzzle input
If you create a file named .session_cookie
containing only your session cookie, you can use the setup
subcommand to create directories for your puzzle and automatically download the puzzle input.
Automatic setup of each puzzle directory
challenge setup 2023 3 1
For example, the above would create directories for the year 2023, day 3, challenge 1; then inside will drop the input.txt
file, an empty test_input.txt
file, a template run.lua
file, and an empty README.md
to put the challenge info into (if you want to).
Note about the above:
The setup command currently will "fail" if you attempt to run it without a session cookie. It will still generate all the other files mentioned, just not the input.txt
file.
Easier input and output
When running your code, the runner will supply an input
filehandle and an output
filehandle, adding a .lines()
method to the input which will return a table of all lines (with .n
being the total amount of lines).
Anything outputted will be pushed to both /challengeroot/current_output.txt
and /challengeroot/year/day/challenge/output.txt
. You can copy your output from there, or just write what is displayed. Anything printed normally will not be outputted.
This also allows you to test your challenge input on the test input given by the Advent's challenge. Simply appending test
as the last argument of the run command will make it use the selected challenge's test_input.txt
file.
challenge 2023 3 1 test
Easy library handling
The folder /challengeroot/challenge_libs
is available to all challenges. Drop any useful libraries you have in there and all challenges can use them.
Planned features
- A rewrite lol
- Parsing the page for the challenge itself, to pull information into the README.
- Ideally you shouldn't even need to open your browser. It may be possible for me to implement a proper login system that will generate a session cookie for you?
- More logging capabilities, and perhaps exposing the logger to the challenges as well.