New nostalgic Advent of Code in PHP! I worked in PHP for many years, so this time I want to remind those days to myself. To see the original tasks for all days and previous years, visit https://adventofcode.com/. All credits to them for this nice work!
- Year 2019 in Elixir: https://github.com/arxeiss/advent-of-code-2019
- Year 2020 in Go: https://github.com/arxeiss/advent-of-code-2020
- Year 2022 in PHP: https://github.com/arxeiss/advent-of-code-2022
See each day for more information. I copied the instructions there as well.
- Install PHP 8+ and Composer https://getcomposer.org/download/
- Clone this repo
- Install dependencies with
php composer install
- Run:
php start.php
to execute runnerphp vendor/bin/phpunit
to start testsphp vendor/bin/phpcs
to run linter
If you don't want to install PHP locally, I suggest to use ./php
bash script which will execute it in PHP docker.
To download Composer locally use this
wget https://composer.github.io/installer.sig -O - -q | tr -d '\n' > installer.sig
./php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
./php -r "if (hash_file('SHA384', 'composer-setup.php') === file_get_contents('installer.sig')) { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
./php composer-setup.php
./php -r "unlink('composer-setup.php'); unlink('installer.sig');"
If you have problem with
./php composer-setup.php
remove from./php
temporarily the part--user "$(id -u):$(id -g)"
Then it remains the same, just use ./php
instead of php
- Day 20: I did not realized the endless pane will be changing from zeros to ones and back... The hint from Kobzol was required.
- Day 21: I failed with 2 points here. So I went to Reddit for some help and I have found others having same questions.
- I did not realized, that in Part 2 each player roll dice 3 times. So not creating 3 universes, but 3x3 universes. Reddit link
- I had no idea how to solve it. So I reached for another topic, where the concept of maximum 44100 combinations was described. Reddit link
- Day 1: Sonar Sweep
- Day 2: Dive!
- Day 3: Binary Diagnostic
- Day 4: Giant Squid
- Day 5: Hydrothermal Venture
- Day 6: Lanternfish
- Day 7: The Treachery of Whales
- Day 8: Seven Segment Search
- Day 9: Smoke Basin
- Day 10: Syntax Scoring
- Day 11: Dumbo Octopus
- Day 12: Passage Pathing
- Day 13: Transparent Origami
- Day 14: Extended Polymerization
- Day 15: Chiton
- Day 16: Packet Decoder
- Day 17: Trick Shot
- Day 18: Snailfish
- Day 20: Trench Map
- Day 21: Dirac Dice