Personal solutions and small framework to help to solve Advent Of Code puzzle.
- PHP >=7.1.3
- Composer
- Clone repository
- Run
composer install
- Create your local
.env
file by copying.end.dist
and removing.dist
part. - Pull adventofcode.com session token (You can use any modern browser developer tools) and update
AOC_SESSIONID
value in.env
file
All puzzles are placed under src/YearX/DayX
structure.
Each day has files:
- Puzzle.php file, where first and second parts are solved separately.
- PuzzleTest.php file, where test inputs for each puzzle part are placed and corresponding answers.
- input.txt - this is your main puzzle input, which is used to generate the answer.
Each day could follow this workflow to solve the puzzles:
- Generate structure for a puzzle by running
app p:g <day>
command. - Downloading the input by running
app p:d:i <day>
command. - Creating solution
- Optionally updating PuzzleTest with tests
- And then running the solution with command
app p:r <day> <part:first|second>
Usage:
app puzzle:run [<day>] [<part>] [options]
app p:r [<day>] [<part>] [options]
Arguments:
day Day of the puzzle
part Available options: 'first','secong'. Part of the puzzle
Options:
--year[=YEAR] Year of the puzzle [default: current year]
-t Execute tests
--file[=FILE] Execute puzzle with given input from the file
To Be Added:
Option --send
With this option, result from the puzzle will be sent to adventofcode.com
For this you must have updated .env file with session ID
Usage:
app puzzle:generate [<day>] [options]
app p:g [<day>] [options]
Arguments:
day Day of the puzzle
Options:
--year[=YEAR] Year of the puzzle [default: current year]
--force -f Replace current structure with new one
For command to work, you must have updated .env file with session ID
Download puzzle input from adventofcode.com.
For this you must have updated .env file with session ID
Usage:
app puzzle:download:input [<day>] [options]
app p:d:i [<day>] [options]
Arguments:
day Day of the puzzle
Options:
--year[=YEAR] -y Year of the puzzle [default: current year]
- Fix the option to send the puzzle result to Advent Of Code
- Add docker support
- Update
puzzle:run
command to have shorter syntax when selecting part of the puzzle.