Download today's puzzle input from adventofcode, create a directory for this day and some template files to solve the puzzle in a given language.
- python3
- poetry (https://python-poetry.org/docs/) or you can install manually:
- requests (
pip3 install requests
) - pytest (
pip3 install pytest
) (only if you solve puzzles in python) - if you want to get your puzzle input downloaded automatically,
- log into adventofcode via your browser and get the content of the session cookie
- in your terminal, do
export AOC_SESSION=your-session-id
$ python3 init.py --help
usage: init.py [-h] [-d DAY] [-y YEAR] [-l LANGUAGE [LANGUAGE ...]]
[--no-download]
optional arguments:
-h, --help show this help message and exit
-d DAY, --day DAY
-y YEAR, --year YEAR
-l LANGUAGE [LANGUAGE ...], --language LANGUAGE [LANGUAGE ...]
--no-download
If no day / year is given, the current date is used. language
defaults to py
.
$ export AOC_SESSION=your-session-id
$ python3 init.py -l cpp
poetry run shell-command --command='python "${watch_src_path}"' --patterns="*.py" --recursive year2022
poetry run python run.py --help
usage: run.py [-h] [-d DAY] [-y YEAR] [-l LANGUAGE [LANGUAGE ...]]
options:
-h, --help show this help message and exit
-d DAY, --day DAY
-y YEAR, --year YEAR
-l LANGUAGE [LANGUAGE ...], --language LANGUAGE [LANGUAGE ...]
- automated testing
- less broken jank structure
- linting
Templates are in templates/py
$ python init.py
$ cd dayXX
$ pytest
$ python solver.py
Templates are in templates/cpp
$ python init.py -l cpp
$ cd dayXX
$ make test
$ make run
Utilities are in utils/cpp
. cd utils/cpp; make
to test Utils.cpp
Templates are in templates/hs
$ python init.py -l hs
$ cd dayXX
$ ghc -i../utils/hs solver.hs
$ ./solver
Run tests with ./solver --test
or in the repl:
$ ghci -i../utils/hs solver.hs
λ> test1
λ> test2
You can also run only part one or two with ./solver --part 1
.
Utilities are in utils/hs