diff --git a/.github/workflows/qa.yml b/.github/workflows/qa.yml index abb3c0c..61ecf9b 100644 --- a/.github/workflows/qa.yml +++ b/.github/workflows/qa.yml @@ -13,7 +13,7 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: "8.3" - tools: phpcs:3.10, php-cs-fixer:3.64, phpstan:1.12 + tools: phpcs:3.10, php-cs-fixer:3.64, phpstan:2.0.1 coverage: none env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -45,7 +45,7 @@ jobs: with: php-version: "8.3" extensions: mbstring, bcmath, xdebug - tools: phpunit:11.3 + tools: phpunit:11.4 coverage: xdebug env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/README.md b/README.md index 903afd4..e8e9f83 100644 --- a/README.md +++ b/README.md @@ -9,8 +9,8 @@ * My AoC username: `tbali0524` * [Puzzle list](puzzles.md) with topics and my completion status * Some [memes](memes.md) from AoC subreddit -* Link to this repo on [GitHub](https://github.com/tbali0524/advent-of-code-solutions) -* Link to my _partial_ rewrite of this repo in `Rust` on [GitHub](https://github.com/tbali0524/advent-of-code-rust) +* Link to [this repo on GitHub](https://github.com/tbali0524/advent-of-code-solutions) +* Link to my partial [rewrite of the solution in `Rust` on GitHub](https://github.com/tbali0524/advent-of-code-rust) ## Installation diff --git a/phpstan.dist.neon b/phpstan.dist.neon index 2cd3c37..9ecd545 100644 --- a/phpstan.dist.neon +++ b/phpstan.dist.neon @@ -1,10 +1,10 @@ # PHPStan configuration file. # -# minimum version: ^1.12 +# minimum version: ^2.0.1 # # @see https://phpstan.org/config-reference parameters: - level: 9 + level: max phpVersion: 80300 editorUrl: 'vscode://file/%%file%%:%%line%%' tmpDir: .tools/phpstan @@ -14,10 +14,7 @@ parameters: excludePaths: - .git - .tools + - .vscode (?) - vendor - ignoreErrors: - - - message: '#^(Static )?[Mm]ethod TBali[a-zA-Z0-9\\_]+::[a-zA-Z0-9_]+\(\) is unused\.$#' - identifier: method.unused includes: - phar://phpstan.phar/conf/bleedingEdge.neon diff --git a/phpunit.xml b/phpunit.xml index 4d2804a..87b8f82 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -2,13 +2,13 @@ diff --git a/results.md b/results.md index 41126d8..dd2550b 100644 --- a/results.md +++ b/results.md @@ -1,10 +1,10 @@ # Results for all seasons -* Local run on 2024.09.02 -* PHP `8.3.11` +* Local run on 2024.11.11 +* PHP `8.3.13` * Total running time: - * with AocRunner (PHP + JIT): `143 sec` - * with PhpUnit (XDebug + coverage): `34 sec` (less puzzles) + * with AocRunner (PHP + JIT): `118 sec` + * with PhpUnit (XDebug + coverage): `36 sec` (less puzzles) ```txt Advent of Code - batch solution runner, (c) 2024 by TBali @@ -14,259 +14,259 @@ Advent of Code - batch solution runner, (c) 2024 by TBali [ OK ] Puzzle examples (2) passed. [ OK ] 74 [ OK ] 1795 -=== AoC 2015 Day 02 [time: 0.013 sec; memory: 1 Mbytes] I Was Told There Would Be No Math +=== AoC 2015 Day 02 [time: 0.006 sec; memory: 1 Mbytes] I Was Told There Would Be No Math [ OK ] Puzzle examples (2) passed. [ OK ] 1606483 [ OK ] 3842356 -=== AoC 2015 Day 03 [time: 0.008 sec; memory: 1 Mbytes] Perfectly Spherical Houses in a Vacuum +=== AoC 2015 Day 03 [time: 0.016 sec; memory: 1 Mbytes] Perfectly Spherical Houses in a Vacuum [ OK ] Puzzle examples (2) passed. [ OK ] 2592 [ OK ] 2360 -=== AoC 2015 Day 04 [time: 3.154 sec; memory: 1 Mbytes] The Ideal Stocking Stuffer +=== AoC 2015 Day 04 [time: 2.889 sec; memory: 1 Mbytes] The Ideal Stocking Stuffer [ OK ] Puzzle examples (2) passed. [ OK ] 254575 [ OK ] 1038736 -=== AoC 2015 Day 05 [time: 0.019 sec; memory: 1 Mbytes] Doesn't He Have Intern-Elves For This? +=== AoC 2015 Day 05 [time: 0.029 sec; memory: 1 Mbytes] Doesn't He Have Intern-Elves For This? [ OK ] Puzzle examples (2) passed. [ OK ] 238 [ OK ] 69 -=== AoC 2015 Day 06 [time: 1.890 sec; memory: 21 Mbytes] Probably a Fire Hazard +=== AoC 2015 Day 06 [time: 1.130 sec; memory: 21 Mbytes] Probably a Fire Hazard [ OK ] Puzzle examples (2) passed. [ OK ] 377891 [ OK ] 14110788 -=== AoC 2015 Day 07 [time: 0.009 sec; memory: 1 Mbytes] Some Assembly Required +=== AoC 2015 Day 07 [time: 0.041 sec; memory: 1 Mbytes] Some Assembly Required [ OK ] Puzzle example passed. [ OK ] 956 [ OK ] 40149 -=== AoC 2015 Day 08 [time: 0.006 sec; memory: 1 Mbytes] Matchsticks +=== AoC 2015 Day 08 [time: 0.015 sec; memory: 1 Mbytes] Matchsticks [ OK ] Puzzle example passed. [ OK ] 1371 [ OK ] 2117 -=== AoC 2015 Day 09 [time: 0.019 sec; memory: 1 Mbytes] All in a Single Night +=== AoC 2015 Day 09 [time: 0.013 sec; memory: 1 Mbytes] All in a Single Night [ OK ] Puzzle example passed. [ OK ] 207 [ OK ] 804 -=== AoC 2015 Day 10 [time: 1.711 sec; memory: 11 Mbytes] Elves Look, Elves Say +=== AoC 2015 Day 10 [time: 1.580 sec; memory: 11 Mbytes] Elves Look, Elves Say [ OK ] Puzzle example passed. [ OK ] 360154 [ OK ] 5103798 -=== AoC 2015 Day 11 [time: 3.718 sec; memory: 1 Mbytes] Corporate Policy +=== AoC 2015 Day 11 [time: 2.172 sec; memory: 1 Mbytes] Corporate Policy [ OK ] Puzzle examples (2) passed. [ OK ] vzbxxyzz [ OK ] vzcaabcc -=== AoC 2015 Day 12 [time: 0.014 sec; memory: 2 Mbytes] JSAbacusFramework.io +=== AoC 2015 Day 12 [time: 0.064 sec; memory: 2 Mbytes] JSAbacusFramework.io [ OK ] Puzzle examples (2) passed. [ OK ] 111754 [ OK ] 65402 -=== AoC 2015 Day 13 [time: 0.271 sec; memory: 1 Mbytes] Knights of the Dinner Table +=== AoC 2015 Day 13 [time: 0.058 sec; memory: 1 Mbytes] Knights of the Dinner Table [ OK ] Puzzle example passed. [ OK ] 709 [ OK ] 668 -=== AoC 2015 Day 14 [time: 0.021 sec; memory: 1 Mbytes] Reindeer Olympic +=== AoC 2015 Day 14 [time: 0.019 sec; memory: 1 Mbytes] Reindeer Olympic [ OK ] Puzzle example passed. [ OK ] 2696 [ OK ] 1084 -=== AoC 2015 Day 15 [time: 0.383 sec; memory: 1 Mbytes] Science for Hungry People +=== AoC 2015 Day 15 [time: 0.147 sec; memory: 1 Mbytes] Science for Hungry People [ OK ] Puzzle example passed. [ OK ] 21367368 [ OK ] 1766400 === AoC 2015 Day 16 [time: 0.012 sec; memory: 1 Mbytes] Aunt Sue [ OK ] 373 [ OK ] 260 -=== AoC 2015 Day 17 [time: 0.240 sec; memory: 1 Mbytes] No Such Thing as Too Much +=== AoC 2015 Day 17 [time: 0.047 sec; memory: 1 Mbytes] No Such Thing as Too Much [ OK ] Puzzle example passed. [ OK ] 1304 [ OK ] 18 -=== AoC 2015 Day 18 [time: 1.095 sec; memory: 1 Mbytes] Like a GIF For Your Yard +=== AoC 2015 Day 18 [time: 0.719 sec; memory: 1 Mbytes] Like a GIF For Your Yard [ OK ] Puzzle example passed. [ OK ] 814 [ OK ] 924 -=== AoC 2015 Day 19 [time: 0.018 sec; memory: 1 Mbytes] Medicine for Rudolph +=== AoC 2015 Day 19 [time: 0.039 sec; memory: 1 Mbytes] Medicine for Rudolph [ OK ] 535 [ OK ] 212 -=== AoC 2015 Day 20 [time: 2.851 sec; memory: 133 Mbytes] Infinite Elves and Infinite Houses +=== AoC 2015 Day 20 [time: 1.081 sec; memory: 133 Mbytes] Infinite Elves and Infinite Houses [ OK ] Puzzle examples (2) passed. [ OK ] 831600 [ OK ] 884520 -=== AoC 2015 Day 21 [time: 0.010 sec; memory: 1 Mbytes] RPG Simulator 20XX +=== AoC 2015 Day 21 [time: 0.034 sec; memory: 1 Mbytes] RPG Simulator 20XX [ OK ] 111 [ OK ] 188 -=== AoC 2015 Day 22 [time: 0.381 sec; memory: 45 Mbytes] Wizard Simulator 20XX +=== AoC 2015 Day 22 [time: 0.321 sec; memory: 45 Mbytes] Wizard Simulator 20XX [ OK ] 900 [ OK ] 1216 -=== AoC 2015 Day 23 [time: 0.004 sec; memory: 2 Mbytes] Opening the Turing Lock +=== AoC 2015 Day 23 [time: 0.013 sec; memory: 2 Mbytes] Opening the Turing Lock [ OK ] Puzzle example passed. [ OK ] 170 [ OK ] 247 -=== AoC 2015 Day 24 [time: 0.444 sec; memory: 92 Mbytes] It Hangs in the Balance +=== AoC 2015 Day 24 [time: 0.234 sec; memory: 92 Mbytes] It Hangs in the Balance [ OK ] Puzzle example passed. [ OK ] 10439961859 [ OK ] 72050269 -=== AoC 2015 Day 25 [time: 0.186 sec; memory: 2 Mbytes] Let It Snow +=== AoC 2015 Day 25 [time: 0.100 sec; memory: 2 Mbytes] Let It Snow [ OK ] Puzzle examples (2) passed. [ OK ] 19980801 ======= 2016 ============================================= -=== AoC 2016 Day 01 [time: 0.006 sec; memory: 2 Mbytes] No Time for a Taxicab +=== AoC 2016 Day 01 [time: 0.009 sec; memory: 2 Mbytes] No Time for a Taxicab [ OK ] Puzzle example passed. [ OK ] 262 [ OK ] 131 -=== AoC 2016 Day 02 [time: 0.007 sec; memory: 2 Mbytes] Bathroom Security +=== AoC 2016 Day 02 [time: 0.018 sec; memory: 2 Mbytes] Bathroom Security [ OK ] Puzzle example passed. [ OK ] 24862 [ OK ] 46C91 === AoC 2016 Day 03 [time: 0.011 sec; memory: 3 Mbytes] Squares With Three Sides [ OK ] 982 [ OK ] 1826 -=== AoC 2016 Day 04 [time: 0.012 sec; memory: 2 Mbytes] Security Through Obscurity +=== AoC 2016 Day 04 [time: 0.014 sec; memory: 2 Mbytes] Security Through Obscurity [ OK ] Puzzle example passed. [ OK ] 137896 [ OK ] 501 === AoC 2016 Day 05 [WARN] Skipped. -=== AoC 2016 Day 06 [time: 0.003 sec; memory: 2 Mbytes] Signals and Noise +=== AoC 2016 Day 06 [time: 0.006 sec; memory: 2 Mbytes] Signals and Noise [ OK ] Puzzle example passed. [ OK ] cyxeoccr [ OK ] batwpask -=== AoC 2016 Day 07 [time: 0.038 sec; memory: 2 Mbytes] Internet Protocol Version 7 +=== AoC 2016 Day 07 [time: 0.113 sec; memory: 2 Mbytes] Internet Protocol Version 7 [ OK ] Puzzle examples (2) passed. [ OK ] 118 [ OK ] 260 -=== AoC 2016 Day 08 [time: 0.009 sec; memory: 2 Mbytes] Two-Factor Authentication +=== AoC 2016 Day 08 [time: 0.026 sec; memory: 2 Mbytes] Two-Factor Authentication [ OK ] Puzzle example passed. [ OK ] 110 [ OK ] ZJHRKCPLYJ -=== AoC 2016 Day 09 [time: 0.004 sec; memory: 2 Mbytes] Explosives in Cyberspace +=== AoC 2016 Day 09 [time: 0.017 sec; memory: 2 Mbytes] Explosives in Cyberspace [ OK ] Puzzle examples (2) passed. [ OK ] 74532 [ OK ] 11558231665 -=== AoC 2016 Day 10 [time: 0.011 sec; memory: 2 Mbytes] Balance Bot +=== AoC 2016 Day 10 [time: 0.016 sec; memory: 2 Mbytes] Balance Bot [ OK ] Puzzle example passed. [ OK ] 181 [ OK ] 12567 === AoC 2016 Day 11 [WARN] Skipped. -=== AoC 2016 Day 12 [time: 10.578 sec; memory: 2 Mbytes] Leonardo's Monorail +=== AoC 2016 Day 12 [time: 2.842 sec; memory: 2 Mbytes] Leonardo's Monorail [ OK ] Puzzle example passed. [ OK ] 318007 [ OK ] 9227661 -=== AoC 2016 Day 13 [time: 0.018 sec; memory: 2 Mbytes] A Maze of Twisty Little Cubicles +=== AoC 2016 Day 13 [time: 0.025 sec; memory: 2 Mbytes] A Maze of Twisty Little Cubicles [ OK ] Puzzle example passed. [ OK ] 92 [ OK ] 124 === AoC 2016 Day 14 [WARN] Skipped. -=== AoC 2016 Day 15 [time: 0.009 sec; memory: 2 Mbytes] Timing is Everything +=== AoC 2016 Day 15 [time: 0.002 sec; memory: 2 Mbytes] Timing is Everything [ OK ] Puzzle example passed. [ OK ] 317371 [ OK ] 2080951 -=== AoC 2016 Day 16 [time: 5.821 sec; memory: 1610 Mbytes] Dragon Checksum +=== AoC 2016 Day 16 [time: 2.163 sec; memory: 1610 Mbytes] Dragon Checksum [ OK ] Puzzle example passed. [ OK ] 00100111000101111 [ OK ] 11101110011100110 -=== AoC 2016 Day 17 [time: 0.345 sec; memory: 35 Mbytes] Two Steps Forward +=== AoC 2016 Day 17 [time: 0.170 sec; memory: 35 Mbytes] Two Steps Forward [ OK ] Puzzle examples (2) passed. [ OK ] DUDRLRRDDR [ OK ] 788 -=== AoC 2016 Day 18 [time: 6.820 sec; memory: 2 Mbytes] Like a Rogue +=== AoC 2016 Day 18 [time: 3.558 sec; memory: 2 Mbytes] Like a Rogue [ OK ] Puzzle examples (2) passed. [ OK ] 1913 [ OK ] 19993564 -=== AoC 2016 Day 19 [time: 0.101 sec; memory: 2 Mbytes] An Elephant Named Joseph +=== AoC 2016 Day 19 [time: 0.042 sec; memory: 2 Mbytes] An Elephant Named Joseph [ OK ] Puzzle example passed. [ OK ] 1841611 [ OK ] 1423634 -=== AoC 2016 Day 20 [time: 0.042 sec; memory: 2 Mbytes] Firewall Rules +=== AoC 2016 Day 20 [time: 0.043 sec; memory: 2 Mbytes] Firewall Rules [ OK ] Puzzle example passed. [ OK ] 19449262 [ OK ] 119 -=== AoC 2016 Day 21 [time: 0.006 sec; memory: 2 Mbytes] Scrambled Letters and Hash +=== AoC 2016 Day 21 [time: 0.011 sec; memory: 2 Mbytes] Scrambled Letters and Hash [ OK ] Puzzle example passed. [ OK ] bfheacgd [ OK ] gcehdbfa -=== AoC 2016 Day 22 [time: 0.089 sec; memory: 3 Mbytes] Grid Computing +=== AoC 2016 Day 22 [time: 0.039 sec; memory: 3 Mbytes] Grid Computing [ OK ] Puzzle example passed. [ OK ] 1034 [ OK ] 261 -=== AoC 2016 Day 23 [time: 0.018 sec; memory: 2 Mbytes] Safe Cracking +=== AoC 2016 Day 23 [time: 0.028 sec; memory: 2 Mbytes] Safe Cracking [ OK ] Puzzle example passed. [ OK ] 13685 [ OK ] 479010245 -=== AoC 2016 Day 24 [time: 1.630 sec; memory: 130 Mbytes] Air Duct Spelunking +=== AoC 2016 Day 24 [time: 1.385 sec; memory: 130 Mbytes] Air Duct Spelunking [ OK ] Puzzle example passed. [ OK ] 502 [ OK ] 724 -=== AoC 2016 Day 25 [time: 1.051 sec; memory: 2 Mbytes] Clock Signal +=== AoC 2016 Day 25 [time: 0.558 sec; memory: 2 Mbytes] Clock Signal [ OK ] 192 ======= 2017 ============================================= === AoC 2017 Day 01 [time: 0.006 sec; memory: 2 Mbytes] Inverse Captcha [ OK ] Puzzle examples (2) passed. [ OK ] 1102 [ OK ] 1076 -=== AoC 2017 Day 02 [time: 0.003 sec; memory: 2 Mbytes] Corruption Checksum +=== AoC 2017 Day 02 [time: 0.006 sec; memory: 2 Mbytes] Corruption Checksum [ OK ] Puzzle examples (2) passed. [ OK ] 48357 [ OK ] 351 -=== AoC 2017 Day 03 [time: 0.007 sec; memory: 2 Mbytes] Spiral Memory +=== AoC 2017 Day 03 [time: 0.027 sec; memory: 2 Mbytes] Spiral Memory [ OK ] Puzzle examples (2) passed. [ OK ] 475 [ OK ] 279138 -=== AoC 2017 Day 04 [time: 0.014 sec; memory: 3 Mbytes] High-Entropy Passphrases +=== AoC 2017 Day 04 [time: 0.013 sec; memory: 3 Mbytes] High-Entropy Passphrases [ OK ] Puzzle examples (2) passed. [ OK ] 386 [ OK ] 208 -=== AoC 2017 Day 05 [time: 1.611 sec; memory: 2 Mbytes] A Maze of Twisty Trampolines, All Alike +=== AoC 2017 Day 05 [time: 0.405 sec; memory: 2 Mbytes] A Maze of Twisty Trampolines, All Alike [ OK ] Puzzle example passed. [ OK ] 396086 [ OK ] 28675390 -=== AoC 2017 Day 06 [time: 0.021 sec; memory: 3 Mbytes] Memory Reallocation +=== AoC 2017 Day 06 [time: 0.017 sec; memory: 3 Mbytes] Memory Reallocation [ OK ] Puzzle example passed. [ OK ] 7864 [ OK ] 1695 -=== AoC 2017 Day 07 [time: 0.012 sec; memory: 3 Mbytes] Recursive Circus +=== AoC 2017 Day 07 [time: 0.028 sec; memory: 3 Mbytes] Recursive Circus [ OK ] Puzzle example passed. [ OK ] gynfwly [ OK ] 1526 -=== AoC 2017 Day 08 [time: 0.004 sec; memory: 2 Mbytes] I Heard You Like Registers +=== AoC 2017 Day 08 [time: 0.033 sec; memory: 2 Mbytes] I Heard You Like Registers [ OK ] Puzzle example passed. [ OK ] 4567 [ OK ] 5636 -=== AoC 2017 Day 09 [time: 0.004 sec; memory: 2 Mbytes] Stream Processing +=== AoC 2017 Day 09 [time: 0.025 sec; memory: 2 Mbytes] Stream Processing [ OK ] Puzzle examples (2) passed. [ OK ] 14204 [ OK ] 6622 -=== AoC 2017 Day 10 [time: 0.021 sec; memory: 2 Mbytes] Knot Hash +=== AoC 2017 Day 10 [time: 0.016 sec; memory: 2 Mbytes] Knot Hash [ OK ] Puzzle examples (2) passed. [ OK ] 52070 [ OK ] 7f94112db4e32e19cf6502073c66f9bb -=== AoC 2017 Day 11 [time: 0.005 sec; memory: 3 Mbytes] Hex Ed +=== AoC 2017 Day 11 [time: 0.003 sec; memory: 3 Mbytes] Hex Ed [ OK ] Puzzle examples (3) passed. [ OK ] 824 [ OK ] 1548 -=== AoC 2017 Day 12 [time: 0.012 sec; memory: 3 Mbytes] Digital Plumber +=== AoC 2017 Day 12 [time: 0.019 sec; memory: 3 Mbytes] Digital Plumber [ OK ] Puzzle example passed. [ OK ] 288 [ OK ] 211 -=== AoC 2017 Day 13 [time: 0.268 sec; memory: 2 Mbytes] Packet Scanners +=== AoC 2017 Day 13 [time: 0.043 sec; memory: 2 Mbytes] Packet Scanners [ OK ] Puzzle example passed. [ OK ] 1728 [ OK ] 3946838 -=== AoC 2017 Day 14 [time: 0.653 sec; memory: 2 Mbytes] Disk Defragmentation +=== AoC 2017 Day 14 [time: 0.171 sec; memory: 2 Mbytes] Disk Defragmentation [ OK ] Puzzle example passed. [ OK ] 8204 [ OK ] 1089 -=== AoC 2017 Day 15 [time: 3.986 sec; memory: 2 Mbytes] Dueling Generators +=== AoC 2017 Day 15 [time: 1.270 sec; memory: 2 Mbytes] Dueling Generators [ OK ] Puzzle example passed. [ OK ] 650 [ OK ] 336 -=== AoC 2017 Day 16 [time: 0.121 sec; memory: 4 Mbytes] Permutation Promenade +=== AoC 2017 Day 16 [time: 0.097 sec; memory: 4 Mbytes] Permutation Promenade [ OK ] Puzzle example passed. [ OK ] eojfmbpkldghncia [ OK ] iecopnahgdflmkjb -=== AoC 2017 Day 17 [time: 1.033 sec; memory: 3 Mbytes] Spinlock +=== AoC 2017 Day 17 [time: 1.050 sec; memory: 3 Mbytes] Spinlock [ OK ] Puzzle example passed. [ OK ] 1642 [ OK ] 33601318 -=== AoC 2017 Day 18 [time: 0.067 sec; memory: 2 Mbytes] Duet +=== AoC 2017 Day 18 [time: 0.082 sec; memory: 2 Mbytes] Duet [ OK ] Puzzle examples (2) passed. [ OK ] 9423 [ OK ] 7620 @@ -274,38 +274,38 @@ Advent of Code - batch solution runner, (c) 2024 by TBali [ OK ] Puzzle example passed. [ OK ] LXWCKGRAOY [ OK ] 17302 -=== AoC 2017 Day 20 [time: 0.079 sec; memory: 3 Mbytes] Particle Swarm +=== AoC 2017 Day 20 [time: 0.070 sec; memory: 3 Mbytes] Particle Swarm [ OK ] Puzzle examples (2) passed. [ OK ] p243 [ OK ] 648 -=== AoC 2017 Day 21 [time: 0.688 sec; memory: 284 Mbytes] Fractal Art +=== AoC 2017 Day 21 [time: 0.678 sec; memory: 284 Mbytes] Fractal Art [ OK ] Puzzle example passed. [ OK ] 125 [ OK ] 1782917 -=== AoC 2017 Day 22 [time: 4.380 sec; memory: 14 Mbytes] Sporifica Virus +=== AoC 2017 Day 22 [time: 4.988 sec; memory: 14 Mbytes] Sporifica Virus [ OK ] Puzzle example passed. [ OK ] 5538 [ OK ] 2511090 -=== AoC 2017 Day 23 [time: 0.030 sec; memory: 2 Mbytes] Coprocessor Conflagration +=== AoC 2017 Day 23 [time: 0.038 sec; memory: 3 Mbytes] Coprocessor Conflagration [ OK ] 8281 [ OK ] 911 -=== AoC 2017 Day 24 [time: 0.199 sec; memory: 33 Mbytes] Electromagnetic Moat +=== AoC 2017 Day 24 [time: 0.209 sec; memory: 33 Mbytes] Electromagnetic Moat [ OK ] Puzzle example passed. [ OK ] 1656 [ OK ] 1642 -=== AoC 2017 Day 25 [time: 1.125 sec; memory: 3 Mbytes] The Halting Problem +=== AoC 2017 Day 25 [time: 1.255 sec; memory: 3 Mbytes] The Halting Problem [ OK ] Puzzle example passed. [ OK ] 2832 ======= 2018 ============================================= -=== AoC 2018 Day 01 [time: 0.011 sec; memory: 18 Mbytes] Chronal Calibration +=== AoC 2018 Day 01 [time: 0.012 sec; memory: 18 Mbytes] Chronal Calibration [ OK ] Puzzle example passed. [ OK ] 590 [ OK ] 83445 -=== AoC 2018 Day 02 [time: 0.038 sec; memory: 3 Mbytes] Inventory Management System +=== AoC 2018 Day 02 [time: 0.065 sec; memory: 3 Mbytes] Inventory Management System [ OK ] Puzzle examples (2) passed. [ OK ] 7470 [ OK ] kqzxdenujwcstybmgvyiofrrd -=== AoC 2018 Day 03 [time: 0.053 sec; memory: 23 Mbytes] No Matter How You Slice It +=== AoC 2018 Day 03 [time: 0.056 sec; memory: 23 Mbytes] No Matter How You Slice It [ OK ] Puzzle example passed. [ OK ] 118322 [ OK ] 1178 @@ -313,39 +313,39 @@ Advent of Code - batch solution runner, (c) 2024 by TBali [ OK ] Puzzle example passed. [ OK ] 19830 [ OK ] 43695 -=== AoC 2018 Day 05 [time: 0.335 sec; memory: 3 Mbytes] Alchemical Reduction +=== AoC 2018 Day 05 [time: 0.385 sec; memory: 3 Mbytes] Alchemical Reduction [ OK ] Puzzle example passed. [ OK ] 10638 [ OK ] 4944 -=== AoC 2018 Day 06 [time: 0.682 sec; memory: 3 Mbytes] Chronal Coordinates +=== AoC 2018 Day 06 [time: 0.736 sec; memory: 3 Mbytes] Chronal Coordinates [ OK ] Puzzle example passed. [ OK ] 3006 [ OK ] 42998 -=== AoC 2018 Day 07 [time: 0.033 sec; memory: 3 Mbytes] The Sum of Its Parts +=== AoC 2018 Day 07 [time: 0.027 sec; memory: 3 Mbytes] The Sum of Its Parts [ OK ] Puzzle example passed. [ OK ] BKCJMSDVGHQRXFYZOAULPIEWTN [ OK ] 1040 -=== AoC 2018 Day 08 [time: 0.010 sec; memory: 4 Mbytes] Memory Maneuver +=== AoC 2018 Day 08 [time: 0.014 sec; memory: 4 Mbytes] Memory Maneuver [ OK ] Puzzle example passed. [ OK ] 47244 [ OK ] 17267 -=== AoC 2018 Day 09 [time: 4.552 sec; memory: 668 Mbytes] Marble Mania +=== AoC 2018 Day 09 [time: 4.535 sec; memory: 668 Mbytes] Marble Mania [ OK ] Puzzle examples (6) passed. [ OK ] 429943 [ OK ] 3615691746 -=== AoC 2018 Day 10 [time: 0.309 sec; memory: 66 Mbytes] The Stars Align +=== AoC 2018 Day 10 [time: 0.285 sec; memory: 66 Mbytes] The Stars Align [ OK ] Puzzle example passed. [ OK ] BLGNHPJC [ OK ] 10476 -=== AoC 2018 Day 11 [time: 2.694 sec; memory: 73 Mbytes] Chronal Charge +=== AoC 2018 Day 11 [time: 3.450 sec; memory: 73 Mbytes] Chronal Charge [ OK ] Puzzle examples (2) passed. [ OK ] 20,50 [ OK ] 238,278,9 -=== AoC 2018 Day 12 [time: 0.017 sec; memory: 66 Mbytes] Subterranean Sustainability +=== AoC 2018 Day 12 [time: 0.021 sec; memory: 66 Mbytes] Subterranean Sustainability [ OK ] Puzzle example passed. [ OK ] 3915 [ OK ] 4900000001793 -=== AoC 2018 Day 13 [time: 0.059 sec; memory: 66 Mbytes] Mine Cart Madness +=== AoC 2018 Day 13 [time: 0.057 sec; memory: 66 Mbytes] Mine Cart Madness [ OK ] Puzzle examples (2) passed. [ OK ] 111,13 [ OK ] 16,73 @@ -353,149 +353,149 @@ Advent of Code - batch solution runner, (c) 2024 by TBali [WARN] Skipped. === AoC 2018 Day 15 [WARN] Skipped. -=== AoC 2018 Day 16 [time: 0.023 sec; memory: 67 Mbytes] Chronal Classification +=== AoC 2018 Day 16 [time: 0.029 sec; memory: 67 Mbytes] Chronal Classification [ OK ] Puzzle example passed. [ OK ] 605 [ OK ] 653 -=== AoC 2018 Day 17 [time: 0.029 sec; memory: 71 Mbytes] Reservoir Research +=== AoC 2018 Day 17 [time: 0.031 sec; memory: 71 Mbytes] Reservoir Research [ OK ] Puzzle example passed. [ OK ] 33052 [ OK ] 27068 -=== AoC 2018 Day 18 [time: 0.826 sec; memory: 67 Mbytes] Settlers of The North Pole +=== AoC 2018 Day 18 [time: 0.914 sec; memory: 67 Mbytes] Settlers of The North Pole [ OK ] Puzzle example passed. [ OK ] 536370 [ OK ] 190512 -=== AoC 2018 Day 19 [time: 0.174 sec; memory: 66 Mbytes] Go With The Flow +=== AoC 2018 Day 19 [time: 0.256 sec; memory: 66 Mbytes] Go With The Flow [ OK ] Puzzle example passed. [ OK ] 2106 [ OK ] 23021280 -=== AoC 2018 Day 20 [time: 0.451 sec; memory: 72 Mbytes] A Regular Map +=== AoC 2018 Day 20 [time: 0.496 sec; memory: 72 Mbytes] A Regular Map [ OK ] Puzzle examples (5) passed. [ OK ] 3991 [ OK ] 8394 -=== AoC 2018 Day 21 [time: 0.004 sec; memory: 67 Mbytes] Chronal Conversion +=== AoC 2018 Day 21 [time: 0.005 sec; memory: 67 Mbytes] Chronal Conversion [ OK ] 3941014 [ OK ] 13775890 -=== AoC 2018 Day 22 [time: 0.906 sec; memory: 93 Mbytes] Mode Maze +=== AoC 2018 Day 22 [time: 1.008 sec; memory: 93 Mbytes] Mode Maze [ OK ] Puzzle example passed. [ OK ] 7299 [ OK ] 1008 -=== AoC 2018 Day 23 [time: 0.442 sec; memory: 67 Mbytes] Experimental Emergency Teleportation +=== AoC 2018 Day 23 [time: 0.430 sec; memory: 67 Mbytes] Experimental Emergency Teleportation [ OK ] Puzzle examples (2) passed. [ OK ] 599 [ OK ] 94481130 -=== AoC 2018 Day 24 [time: 2.132 sec; memory: 66 Mbytes] Immune System Simulator 20XX +=== AoC 2018 Day 24 [time: 2.147 sec; memory: 66 Mbytes] Immune System Simulator 20XX [ OK ] Puzzle example passed. [ OK ] 22859 [ OK ] 2834 -=== AoC 2018 Day 25 [time: 0.254 sec; memory: 66 Mbytes] Four-Dimensional Adventure +=== AoC 2018 Day 25 [time: 0.264 sec; memory: 66 Mbytes] Four-Dimensional Adventure [ OK ] Puzzle examples (4) passed. [ OK ] 324 ======= 2019 ============================================= -=== AoC 2019 Day 01 [time: 0.003 sec; memory: 66 Mbytes] The Tyranny of the Rocket Equation +=== AoC 2019 Day 01 [time: 0.007 sec; memory: 66 Mbytes] The Tyranny of the Rocket Equation [ OK ] Puzzle example passed. [ OK ] 3287620 [ OK ] 4928567 -=== AoC 2019 Day 02 [time: 0.031 sec; memory: 66 Mbytes] 1202 Program Alarm +=== AoC 2019 Day 02 [time: 0.035 sec; memory: 66 Mbytes] 1202 Program Alarm [ OK ] Puzzle examples (2) passed. [ OK ] 3085697 [ OK ] 9425 -=== AoC 2019 Day 03 [time: 0.037 sec; memory: 104 Mbytes] Crossed Wires +=== AoC 2019 Day 03 [time: 0.041 sec; memory: 104 Mbytes] Crossed Wires [ OK ] Puzzle examples (3) passed. [ OK ] 245 [ OK ] 48262 -=== AoC 2019 Day 04 [time: 0.082 sec; memory: 66 Mbytes] Secure Container +=== AoC 2019 Day 04 [time: 0.090 sec; memory: 66 Mbytes] Secure Container [ OK ] Puzzle example passed. [ OK ] 1864 [ OK ] 1258 === AoC 2019 Day 05 [time: 0.003 sec; memory: 66 Mbytes] Sunny with a Chance of Asteroids [ OK ] 4511442 [ OK ] 12648139 -=== AoC 2019 Day 06 [time: 0.016 sec; memory: 66 Mbytes] Universal Orbit Map +=== AoC 2019 Day 06 [time: 0.017 sec; memory: 66 Mbytes] Universal Orbit Map [ OK ] Puzzle examples (2) passed. [ OK ] 247089 [ OK ] 442 -=== AoC 2019 Day 07 [time: 0.083 sec; memory: 66 Mbytes] Amplification Circuit +=== AoC 2019 Day 07 [time: 0.087 sec; memory: 66 Mbytes] Amplification Circuit [ OK ] Puzzle examples (5) passed. [ OK ] 255590 [ OK ] 58285150 === AoC 2019 Day 08 [time: 0.007 sec; memory: 66 Mbytes] Space Image Format [ OK ] 1340 [ OK ] LEJKC -=== AoC 2019 Day 09 [time: 0.161 sec; memory: 66 Mbytes] Sensor Boost +=== AoC 2019 Day 09 [time: 0.172 sec; memory: 66 Mbytes] Sensor Boost [ OK ] Puzzle example passed. [ OK ] 3454977209 [ OK ] 50120 -=== AoC 2019 Day 10 [time: 0.223 sec; memory: 66 Mbytes] Monitoring Station +=== AoC 2019 Day 10 [time: 0.225 sec; memory: 66 Mbytes] Monitoring Station [ OK ] Puzzle examples (6) passed. [ OK ] 292 [ OK ] 317 -=== AoC 2019 Day 11 [time: 0.058 sec; memory: 67 Mbytes] Space Police +=== AoC 2019 Day 11 [time: 0.060 sec; memory: 67 Mbytes] Space Police [ OK ] 2418 [ OK ] GREJALPR -=== AoC 2019 Day 12 [time: 1.109 sec; memory: 66 Mbytes] The N-Body Problem +=== AoC 2019 Day 12 [time: 1.144 sec; memory: 66 Mbytes] The N-Body Problem [ OK ] Puzzle examples (2) passed. [ OK ] 7988 [ OK ] 337721412394184 -=== AoC 2019 Day 13 [time: 0.360 sec; memory: 70 Mbytes] Care Package +=== AoC 2019 Day 13 [time: 0.386 sec; memory: 70 Mbytes] Care Package [ OK ] 173 [ OK ] 8942 -=== AoC 2019 Day 14 [time: 0.028 sec; memory: 66 Mbytes] Space Stoichiometry +=== AoC 2019 Day 14 [time: 0.027 sec; memory: 66 Mbytes] Space Stoichiometry [ OK ] Puzzle examples (5) passed. [ OK ] 346961 [ OK ] 4065790 -=== AoC 2019 Day 15 [time: 0.074 sec; memory: 70 Mbytes] Oxygen System +=== AoC 2019 Day 15 [time: 0.069 sec; memory: 70 Mbytes] Oxygen System [ OK ] 224 [ OK ] 284 === AoC 2019 Day 16 [WARN] Skipped. -=== AoC 2019 Day 17 [time: 0.072 sec; memory: 66 Mbytes] Set and Forget +=== AoC 2019 Day 17 [time: 0.079 sec; memory: 66 Mbytes] Set and Forget [ OK ] 5724 [ OK ] 732985 -=== AoC 2019 Day 18 [time: 1.894 sec; memory: 595 Mbytes] Many-Worlds Interpretation +=== AoC 2019 Day 18 [time: 1.909 sec; memory: 595 Mbytes] Many-Worlds Interpretation [ OK ] Puzzle examples (8) passed. [ OK ] 5858 [ OK ] 2144 === AoC 2019 Day 19 [WARN] Skipped. -=== AoC 2019 Day 20 [time: 0.359 sec; memory: 180 Mbytes] Donut Maze +=== AoC 2019 Day 20 [time: 0.331 sec; memory: 180 Mbytes] Donut Maze [ OK ] Puzzle examples (3) passed. [ OK ] 454 [ OK ] 5744 -=== AoC 2019 Day 21 [time: 0.275 sec; memory: 66 Mbytes] Springdroid Adventure +=== AoC 2019 Day 21 [time: 0.274 sec; memory: 66 Mbytes] Springdroid Adventure [ OK ] 19354818 [ OK ] 1143787220 -=== AoC 2019 Day 22 [time: 0.029 sec; memory: 67 Mbytes] Slam Shuffle +=== AoC 2019 Day 22 [time: 0.031 sec; memory: 67 Mbytes] Slam Shuffle [ OK ] Puzzle examples (4) passed. [ OK ] 8502 [ OK ] 41685581334351 -=== AoC 2019 Day 23 [time: 0.182 sec; memory: 71 Mbytes] Category Six +=== AoC 2019 Day 23 [time: 0.112 sec; memory: 71 Mbytes] Category Six [ OK ] 24922 [ OK ] 19478 -=== AoC 2019 Day 24 [time: 0.331 sec; memory: 67 Mbytes] Planet of Discord +=== AoC 2019 Day 24 [time: 0.304 sec; memory: 67 Mbytes] Planet of Discord [ OK ] Puzzle example passed. [ OK ] 24662545 [ OK ] 2063 -=== AoC 2019 Day 25 [time: 1.947 sec; memory: 71 Mbytes] Cryostasis +=== AoC 2019 Day 25 [time: 2.003 sec; memory: 71 Mbytes] Cryostasis [ OK ] 537002052 ======= 2020 ============================================= -=== AoC 2020 Day 01 [time: 0.016 sec; memory: 66 Mbytes] Report Repair +=== AoC 2020 Day 01 [time: 0.011 sec; memory: 66 Mbytes] Report Repair [ OK ] Puzzle example passed. [ OK ] 988771 [ OK ] 171933104 -=== AoC 2020 Day 02 [time: 0.007 sec; memory: 66 Mbytes] Password Philosophy +=== AoC 2020 Day 02 [time: 0.010 sec; memory: 66 Mbytes] Password Philosophy [ OK ] Puzzle example passed. [ OK ] 434 [ OK ] 509 -=== AoC 2020 Day 03 [time: 0.011 sec; memory: 66 Mbytes] Toboggan Trajectory +=== AoC 2020 Day 03 [time: 0.006 sec; memory: 66 Mbytes] Toboggan Trajectory [ OK ] Puzzle example passed. [ OK ] 211 [ OK ] 3584591857 -=== AoC 2020 Day 04 [time: 0.036 sec; memory: 66 Mbytes] Passport Processing +=== AoC 2020 Day 04 [time: 0.017 sec; memory: 66 Mbytes] Passport Processing [ OK ] Puzzle examples (2) passed. [ OK ] 245 [ OK ] 133 -=== AoC 2020 Day 05 [time: 0.015 sec; memory: 66 Mbytes] Binary Boarding +=== AoC 2020 Day 05 [time: 0.013 sec; memory: 66 Mbytes] Binary Boarding [ OK ] Puzzle examples (2) passed. [ OK ] 894 [ OK ] 579 @@ -503,27 +503,27 @@ Advent of Code - batch solution runner, (c) 2024 by TBali [ OK ] Puzzle example passed. [ OK ] 6291 [ OK ] 3052 -=== AoC 2020 Day 07 [time: 0.010 sec; memory: 67 Mbytes] Handy Haversacks +=== AoC 2020 Day 07 [time: 0.014 sec; memory: 67 Mbytes] Handy Haversacks [ OK ] Puzzle example passed. [ OK ] 115 [ OK ] 1250 -=== AoC 2020 Day 08 [time: 0.012 sec; memory: 66 Mbytes] Handheld Halting +=== AoC 2020 Day 08 [time: 0.013 sec; memory: 66 Mbytes] Handheld Halting [ OK ] Puzzle example passed. [ OK ] 1749 [ OK ] 515 -=== AoC 2020 Day 09 [time: 0.013 sec; memory: 67 Mbytes] Encoding Error +=== AoC 2020 Day 09 [time: 0.018 sec; memory: 67 Mbytes] Encoding Error [ OK ] Puzzle example passed. [ OK ] 466456641 [ OK ] 55732936 -=== AoC 2020 Day 10 [time: 0.006 sec; memory: 66 Mbytes] Adapter Array +=== AoC 2020 Day 10 [time: 0.008 sec; memory: 66 Mbytes] Adapter Array [ OK ] Puzzle examples (2) passed. [ OK ] 2112 [ OK ] 3022415986688 -=== AoC 2020 Day 11 [time: 0.665 sec; memory: 66 Mbytes] Seating System +=== AoC 2020 Day 11 [time: 0.706 sec; memory: 66 Mbytes] Seating System [ OK ] Puzzle example passed. [ OK ] 2263 [ OK ] 2002 -=== AoC 2020 Day 12 [time: 0.008 sec; memory: 66 Mbytes] Rain Risk +=== AoC 2020 Day 12 [time: 0.007 sec; memory: 66 Mbytes] Rain Risk [ OK ] Puzzle example passed. [ OK ] 1710 [ OK ] 62045 @@ -531,87 +531,87 @@ Advent of Code - batch solution runner, (c) 2024 by TBali [ OK ] Puzzle example passed. [ OK ] 261 [ OK ] 807435693182510 -=== AoC 2020 Day 14 [time: 0.041 sec; memory: 76 Mbytes] Docking Data +=== AoC 2020 Day 14 [time: 0.045 sec; memory: 76 Mbytes] Docking Data [ OK ] Puzzle examples (2) passed. [ OK ] 7817357407588 [ OK ] 4335927555692 -=== AoC 2020 Day 15 [time: 15.461 sec; memory: 306 Mbytes] Rambunctious Recitation +=== AoC 2020 Day 15 [time: 8.346 sec; memory: 306 Mbytes] Rambunctious Recitation [ OK ] Puzzle examples (2) passed. [ OK ] 662 [ OK ] 37312 -=== AoC 2020 Day 16 [time: 0.025 sec; memory: 66 Mbytes] Ticket Translation +=== AoC 2020 Day 16 [time: 0.024 sec; memory: 66 Mbytes] Ticket Translation [ OK ] Puzzle examples (2) passed. [ OK ] 27870 [ OK ] 3173135507987 -=== AoC 2020 Day 17 [time: 1.149 sec; memory: 75 Mbytes] Conway Cubes +=== AoC 2020 Day 17 [time: 1.248 sec; memory: 75 Mbytes] Conway Cubes [ OK ] Puzzle example passed. [ OK ] 388 [ OK ] 2280 -=== AoC 2020 Day 18 [time: 0.034 sec; memory: 66 Mbytes] Operation Order +=== AoC 2020 Day 18 [time: 0.036 sec; memory: 66 Mbytes] Operation Order [ OK ] Puzzle examples (2) passed. [ OK ] 12956356593940 [ OK ] 94240043727614 -=== AoC 2020 Day 19 [time: 5.283 sec; memory: 380 Mbytes] Monster Message +=== AoC 2020 Day 19 [time: 5.414 sec; memory: 380 Mbytes] Monster Message [ OK ] Puzzle examples (2) passed. [ OK ] 272 [ OK ] 374 -=== AoC 2020 Day 20 [time: 0.085 sec; memory: 68 Mbytes] Jurassic Jigsaw +=== AoC 2020 Day 20 [time: 0.097 sec; memory: 68 Mbytes] Jurassic Jigsaw [ OK ] Puzzle example passed. [ OK ] 17250897231301 [ OK ] 1576 -=== AoC 2020 Day 21 [time: 0.024 sec; memory: 66 Mbytes] Allergen Assessment +=== AoC 2020 Day 21 [time: 0.035 sec; memory: 66 Mbytes] Allergen Assessment [ OK ] Puzzle example passed. [ OK ] 2380 [ OK ] ktpbgdn,pnpfjb,ndfb,rdhljms,xzfj,bfgcms,fkcmf,hdqkqhh -=== AoC 2020 Day 22 [time: 2.274 sec; memory: 68 Mbytes] Crab Combat +=== AoC 2020 Day 22 [time: 3.123 sec; memory: 68 Mbytes] Crab Combat [ OK ] Puzzle examples (2) passed. [ OK ] 34566 [ OK ] 31854 -=== AoC 2020 Day 23 [time: 2.115 sec; memory: 84 Mbytes] Crab Cups +=== AoC 2020 Day 23 [time: 2.905 sec; memory: 84 Mbytes] Crab Cups [ OK ] Puzzle example passed. [ OK ] 47382659 [ OK ] 42271866720 -=== AoC 2020 Day 24 [time: 0.638 sec; memory: 71 Mbytes] Lobby Layout +=== AoC 2020 Day 24 [time: 0.692 sec; memory: 71 Mbytes] Lobby Layout [ OK ] Puzzle example passed. [ OK ] 391 [ OK ] 3876 -=== AoC 2020 Day 25 [time: 0.011 sec; memory: 66 Mbytes] Combo Breaker +=== AoC 2020 Day 25 [time: 0.019 sec; memory: 66 Mbytes] Combo Breaker [ OK ] Puzzle example passed. [ OK ] 11707042 ======= 2021 ============================================= -=== AoC 2021 Day 01 [time: 0.006 sec; memory: 66 Mbytes] Sonar Sweep +=== AoC 2021 Day 01 [time: 0.008 sec; memory: 66 Mbytes] Sonar Sweep [ OK ] Puzzle example passed. [ OK ] 1477 [ OK ] 1523 -=== AoC 2021 Day 02 [time: 0.007 sec; memory: 66 Mbytes] Dive! +=== AoC 2021 Day 02 [time: 0.012 sec; memory: 66 Mbytes] Dive! [ OK ] Puzzle example passed. [ OK ] 2117664 [ OK ] 2073416724 -=== AoC 2021 Day 03 [time: 0.009 sec; memory: 66 Mbytes] Binary Diagnostic +=== AoC 2021 Day 03 [time: 0.014 sec; memory: 66 Mbytes] Binary Diagnostic [ OK ] Puzzle example passed. [ OK ] 3813416 [ OK ] 2990784 -=== AoC 2021 Day 04 [time: 0.016 sec; memory: 67 Mbytes] Giant Squid +=== AoC 2021 Day 04 [time: 0.032 sec; memory: 66 Mbytes] Giant Squid [ OK ] Puzzle example passed. [ OK ] 6592 [ OK ] 31755 -=== AoC 2021 Day 05 [time: 0.057 sec; memory: 92 Mbytes] Hydrothermal Venture +=== AoC 2021 Day 05 [time: 0.061 sec; memory: 92 Mbytes] Hydrothermal Venture [ OK ] Puzzle example passed. [ OK ] 6841 [ OK ] 19258 -=== AoC 2021 Day 06 [time: 0.003 sec; memory: 66 Mbytes] Lanternfish +=== AoC 2021 Day 06 [time: 0.008 sec; memory: 66 Mbytes] Lanternfish [ OK ] Puzzle example passed. [ OK ] 352195 [ OK ] 1600306001288 -=== AoC 2021 Day 07 [time: 0.151 sec; memory: 66 Mbytes] The Treachery of Whales +=== AoC 2021 Day 07 [time: 0.177 sec; memory: 66 Mbytes] The Treachery of Whales [ OK ] Puzzle example passed. [ OK ] 335330 [ OK ] 92439766 -=== AoC 2021 Day 08 [time: 0.025 sec; memory: 67 Mbytes] Seven Segment Search +=== AoC 2021 Day 08 [time: 0.029 sec; memory: 67 Mbytes] Seven Segment Search [ OK ] Puzzle examples (2) passed. [ OK ] 383 [ OK ] 998900 -=== AoC 2021 Day 09 [time: 0.016 sec; memory: 66 Mbytes] Smoke Basin +=== AoC 2021 Day 09 [time: 0.021 sec; memory: 66 Mbytes] Smoke Basin [ OK ] Puzzle example passed. [ OK ] 486 [ OK ] 1059300 @@ -619,11 +619,11 @@ Advent of Code - batch solution runner, (c) 2024 by TBali [ OK ] Puzzle example passed. [ OK ] 265527 [ OK ] 3969823589 -=== AoC 2021 Day 11 [time: 0.022 sec; memory: 66 Mbytes] Dumbo Octopus +=== AoC 2021 Day 11 [time: 0.030 sec; memory: 66 Mbytes] Dumbo Octopus [ OK ] Puzzle example passed. [ OK ] 1747 [ OK ] 505 -=== AoC 2021 Day 12 [time: 0.155 sec; memory: 66 Mbytes] Passage Pathing +=== AoC 2021 Day 12 [time: 0.177 sec; memory: 66 Mbytes] Passage Pathing [ OK ] Puzzle examples (3) passed. [ OK ] 3779 [ OK ] 96988 @@ -631,11 +631,11 @@ Advent of Code - batch solution runner, (c) 2024 by TBali [ OK ] Puzzle example passed. [ OK ] 724 [ OK ] CPJBERUL -=== AoC 2021 Day 14 [time: 0.015 sec; memory: 67 Mbytes] Extended Polymerization +=== AoC 2021 Day 14 [time: 0.027 sec; memory: 67 Mbytes] Extended Polymerization [ OK ] Puzzle example passed. [ OK ] 2988 [ OK ] 3572761917024 -=== AoC 2021 Day 15 [time: 0.478 sec; memory: 87 Mbytes] Chiton +=== AoC 2021 Day 15 [time: 0.522 sec; memory: 87 Mbytes] Chiton [ OK ] Puzzle example passed. [ OK ] 613 [ OK ] 2899 @@ -643,23 +643,23 @@ Advent of Code - batch solution runner, (c) 2024 by TBali [ OK ] Puzzle examples (13) passed. [ OK ] 953 [ OK ] 246225449979 -=== AoC 2021 Day 17 [time: 0.022 sec; memory: 66 Mbytes] Trick Shot +=== AoC 2021 Day 17 [time: 0.026 sec; memory: 66 Mbytes] Trick Shot [ OK ] Puzzle example passed. [ OK ] 15400 [ OK ] 5844 -=== AoC 2021 Day 18 [time: 1.725 sec; memory: 98 Mbytes] Snailfish +=== AoC 2021 Day 18 [time: 1.859 sec; memory: 98 Mbytes] Snailfish [ OK ] Puzzle example passed. [ OK ] 4008 [ OK ] 4667 -=== AoC 2021 Day 19 [time: 1.940 sec; memory: 71 Mbytes] Beacon Scanner +=== AoC 2021 Day 19 [time: 2.100 sec; memory: 71 Mbytes] Beacon Scanner [ OK ] Puzzle example passed. [ OK ] 308 [ OK ] 12124 -=== AoC 2021 Day 20 [time: 0.711 sec; memory: 70 Mbytes] Trench Map +=== AoC 2021 Day 20 [time: 0.771 sec; memory: 70 Mbytes] Trench Map [ OK ] Puzzle example passed. [ OK ] 5268 [ OK ] 16875 -=== AoC 2021 Day 21 [time: 0.659 sec; memory: 140 Mbytes] Dirac Dice +=== AoC 2021 Day 21 [time: 0.827 sec; memory: 140 Mbytes] Dirac Dice [ OK ] Puzzle example passed. [ OK ] 713328 [ OK ] 92399285032143 @@ -667,10 +667,10 @@ Advent of Code - batch solution runner, (c) 2024 by TBali [WARN] Skipped. === AoC 2021 Day 23 [WARN] Skipped. -=== AoC 2021 Day 24 [time: 4.492 sec; memory: 66 Mbytes] Arithmetic Logic Unit +=== AoC 2021 Day 24 [time: 5.060 sec; memory: 66 Mbytes] Arithmetic Logic Unit [ OK ] 39999698799429 [ OK ] 18116121134117 -=== AoC 2021 Day 25 [time: 0.588 sec; memory: 67 Mbytes] Sea Cucumber +=== AoC 2021 Day 25 [time: 0.616 sec; memory: 67 Mbytes] Sea Cucumber [ OK ] Puzzle example passed. [ OK ] 579 ======= 2022 ============================================= @@ -678,116 +678,116 @@ Advent of Code - batch solution runner, (c) 2024 by TBali [ OK ] Puzzle example passed. [ OK ] 72070 [ OK ] 211805 -=== AoC 2022 Day 02 [time: 0.006 sec; memory: 67 Mbytes] Rock Paper Scissors +=== AoC 2022 Day 02 [time: 0.007 sec; memory: 67 Mbytes] Rock Paper Scissors [ OK ] Puzzle example passed. [ OK ] 12156 [ OK ] 10835 -=== AoC 2022 Day 03 [time: 0.010 sec; memory: 66 Mbytes] Rucksack Reorganization +=== AoC 2022 Day 03 [time: 0.011 sec; memory: 66 Mbytes] Rucksack Reorganization [ OK ] Puzzle example passed. [ OK ] 7766 [ OK ] 2415 -=== AoC 2022 Day 04 [time: 0.011 sec; memory: 67 Mbytes] Camp Cleanup +=== AoC 2022 Day 04 [time: 0.009 sec; memory: 67 Mbytes] Camp Cleanup [ OK ] Puzzle example passed. [ OK ] 530 [ OK ] 903 -=== AoC 2022 Day 05 [time: 0.018 sec; memory: 67 Mbytes] Supply Stacks +=== AoC 2022 Day 05 [time: 0.026 sec; memory: 67 Mbytes] Supply Stacks [ OK ] Puzzle example passed. [ OK ] NTWZZWHFV [ OK ] BRZGFVBTJ -=== AoC 2022 Day 06 [time: 0.006 sec; memory: 66 Mbytes] Tuning Trouble +=== AoC 2022 Day 06 [time: 0.007 sec; memory: 66 Mbytes] Tuning Trouble [ OK ] Puzzle examples (2) passed. [ OK ] 1855 [ OK ] 3256 -=== AoC 2022 Day 07 [time: 0.034 sec; memory: 67 Mbytes] No Space Left On Device +=== AoC 2022 Day 07 [time: 0.022 sec; memory: 67 Mbytes] No Space Left On Device [ OK ] Puzzle example passed. [ OK ] 1390824 [ OK ] 7490863 -=== AoC 2022 Day 08 [time: 0.028 sec; memory: 67 Mbytes] Treetop Tree House +=== AoC 2022 Day 08 [time: 0.030 sec; memory: 67 Mbytes] Treetop Tree House [ OK ] Puzzle example passed. [ OK ] 1796 [ OK ] 288120 -=== AoC 2022 Day 09 [time: 0.025 sec; memory: 67 Mbytes] Rope Bridge +=== AoC 2022 Day 09 [time: 0.027 sec; memory: 67 Mbytes] Rope Bridge [ OK ] Puzzle examples (2) passed. [ OK ] 6090 [ OK ] 2566 -=== AoC 2022 Day 10 [time: 0.003 sec; memory: 67 Mbytes] Cathode-Ray Tube +=== AoC 2022 Day 10 [time: 0.004 sec; memory: 67 Mbytes] Cathode-Ray Tube [ OK ] Puzzle example passed. [ OK ] 15220 [ OK ] RFZEKBFA -=== AoC 2022 Day 11 [time: 2.001 sec; memory: 67 Mbytes] Monkey in the Middle +=== AoC 2022 Day 11 [time: 2.198 sec; memory: 67 Mbytes] Monkey in the Middle [ OK ] Puzzle example passed. [ OK ] Puzzle for large input #1 passed. [ OK ] 121450 [ OK ] 28244037010 -=== AoC 2022 Day 12 [time: 0.009 sec; memory: 67 Mbytes] Hill Climbing Algorithm +=== AoC 2022 Day 12 [time: 0.021 sec; memory: 67 Mbytes] Hill Climbing Algorithm [ OK ] Puzzle example passed. [ OK ] 412 [ OK ] 402 -=== AoC 2022 Day 13 [time: 0.026 sec; memory: 69 Mbytes] Distress Signal +=== AoC 2022 Day 13 [time: 0.032 sec; memory: 69 Mbytes] Distress Signal [ OK ] Puzzle example passed. [ OK ] 5825 [ OK ] 24477 -=== AoC 2022 Day 14 [time: 0.794 sec; memory: 68 Mbytes] Regolith Reservoir +=== AoC 2022 Day 14 [time: 0.928 sec; memory: 68 Mbytes] Regolith Reservoir [ OK ] Puzzle example passed. [ OK ] 828 [ OK ] 25500 -=== AoC 2022 Day 15 [time: 1.706 sec; memory: 547 Mbytes] Beacon Exclusion Zone +=== AoC 2022 Day 15 [time: 1.723 sec; memory: 547 Mbytes] Beacon Exclusion Zone [ OK ] Puzzle example passed. [ OK ] 5142231 [ OK ] 10884459367718 -=== AoC 2022 Day 16 [time: 0.426 sec; memory: 69 Mbytes] Proboscidea Volcanium +=== AoC 2022 Day 16 [time: 0.482 sec; memory: 69 Mbytes] Proboscidea Volcanium [ OK ] Puzzle example passed. [ OK ] 1871 [ OK ] 2416 -=== AoC 2022 Day 17 [time: 0.044 sec; memory: 67 Mbytes] Pyroclastic Flow +=== AoC 2022 Day 17 [time: 0.048 sec; memory: 67 Mbytes] Pyroclastic Flow [ OK ] Puzzle example passed. [ OK ] 3161 [ OK ] 1575931232076 -=== AoC 2022 Day 18 [time: 0.034 sec; memory: 69 Mbytes] Boiling Boulders +=== AoC 2022 Day 18 [time: 0.039 sec; memory: 69 Mbytes] Boiling Boulders [ OK ] Puzzle examples (2) passed. [ OK ] 3498 [ OK ] 2008 === AoC 2022 Day 19 [WARN] Skipped. -=== AoC 2022 Day 20 [time: 1.564 sec; memory: 68 Mbytes] Grove Positioning System +=== AoC 2022 Day 20 [time: 1.721 sec; memory: 68 Mbytes] Grove Positioning System [ OK ] Puzzle example passed. [ OK ] 2203 [ OK ] 6641234038999 -=== AoC 2022 Day 21 [time: 0.014 sec; memory: 67 Mbytes] Monkey Math +=== AoC 2022 Day 21 [time: 0.015 sec; memory: 67 Mbytes] Monkey Math [ OK ] Puzzle example passed. [ OK ] 78342931359552 [ OK ] 3296135418820 -=== AoC 2022 Day 22 [time: 0.029 sec; memory: 67 Mbytes] Monkey Map +=== AoC 2022 Day 22 [time: 0.031 sec; memory: 67 Mbytes] Monkey Map [ OK ] Puzzle example passed. [ OK ] 136054 [ OK ] 122153 -=== AoC 2022 Day 23 [time: 4.503 sec; memory: 69 Mbytes] Unstable Diffusion +=== AoC 2022 Day 23 [time: 4.753 sec; memory: 69 Mbytes] Unstable Diffusion [ OK ] Puzzle example passed. [ OK ] 3766 [ OK ] 954 === AoC 2022 Day 24 [WARN] Skipped. -=== AoC 2022 Day 25 [time: 0.010 sec; memory: 67 Mbytes] Full of Hot Air +=== AoC 2022 Day 25 [time: 0.014 sec; memory: 67 Mbytes] Full of Hot Air [ OK ] Puzzle example passed. [ OK ] 20==1==12=0111=2--20 ======= 2023 ============================================= -=== AoC 2023 Day 01 [time: 0.045 sec; memory: 67 Mbytes] Trebuchet?! +=== AoC 2023 Day 01 [time: 0.047 sec; memory: 67 Mbytes] Trebuchet?! [ OK ] Puzzle examples (2) passed. [ OK ] 56108 [ OK ] 55652 -=== AoC 2023 Day 02 [time: 0.010 sec; memory: 67 Mbytes] Cube Conundrum +=== AoC 2023 Day 02 [time: 0.034 sec; memory: 67 Mbytes] Cube Conundrum [ OK ] Puzzle example passed. [ OK ] 2617 [ OK ] 59795 -=== AoC 2023 Day 03 [time: 0.016 sec; memory: 67 Mbytes] Gear Ratios +=== AoC 2023 Day 03 [time: 0.040 sec; memory: 67 Mbytes] Gear Ratios [ OK ] Puzzle example passed. [ OK ] 530849 [ OK ] 84900879 -=== AoC 2023 Day 04 [time: 0.010 sec; memory: 67 Mbytes] Scratchcards +=== AoC 2023 Day 04 [time: 0.024 sec; memory: 67 Mbytes] Scratchcards [ OK ] Puzzle example passed. [ OK ] 21088 [ OK ] 6874754 -=== AoC 2023 Day 05 [time: 0.013 sec; memory: 67 Mbytes] If You Give A Seed A Fertilizer +=== AoC 2023 Day 05 [time: 0.022 sec; memory: 67 Mbytes] If You Give A Seed A Fertilizer [ OK ] Puzzle example passed. [ OK ] 289863851 [ OK ] 60568880 @@ -795,80 +795,80 @@ Advent of Code - batch solution runner, (c) 2024 by TBali [ OK ] Puzzle example passed. [ OK ] 3316275 [ OK ] 27102791 -=== AoC 2023 Day 07 [time: 0.035 sec; memory: 67 Mbytes] Camel Cards +=== AoC 2023 Day 07 [time: 0.039 sec; memory: 67 Mbytes] Camel Cards [ OK ] Puzzle example passed. [ OK ] 251121738 [ OK ] 251421071 -=== AoC 2023 Day 08 [time: 0.034 sec; memory: 69 Mbytes] Haunted Wasteland +=== AoC 2023 Day 08 [time: 0.036 sec; memory: 69 Mbytes] Haunted Wasteland [ OK ] Puzzle examples (3) passed. [ OK ] 21883 [ OK ] 12833235391111 -=== AoC 2023 Day 09 [time: 0.022 sec; memory: 67 Mbytes] Mirage Maintenance +=== AoC 2023 Day 09 [time: 0.025 sec; memory: 67 Mbytes] Mirage Maintenance [ OK ] Puzzle example passed. [ OK ] 1861775706 [ OK ] 1082 -=== AoC 2023 Day 10 [time: 0.048 sec; memory: 78 Mbytes] Pipe Maze +=== AoC 2023 Day 10 [time: 0.043 sec; memory: 78 Mbytes] Pipe Maze [ OK ] Puzzle examples (6) passed. [ OK ] 6820 [ OK ] 337 -=== AoC 2023 Day 11 [time: 0.228 sec; memory: 67 Mbytes] Cosmic Expansion +=== AoC 2023 Day 11 [time: 0.202 sec; memory: 67 Mbytes] Cosmic Expansion [ OK ] Puzzle example passed. [ OK ] 9329143 [ OK ] 710674907809 -=== AoC 2023 Day 12 [time: 0.404 sec; memory: 170 Mbytes] Hot Springs +=== AoC 2023 Day 12 [time: 0.455 sec; memory: 170 Mbytes] Hot Springs [ OK ] Puzzle example passed. [ OK ] 8193 [ OK ] 45322533163795 -=== AoC 2023 Day 13 [time: 0.044 sec; memory: 67 Mbytes] Point of Incidence +=== AoC 2023 Day 13 [time: 0.051 sec; memory: 67 Mbytes] Point of Incidence [ OK ] Puzzle example passed. [ OK ] 29165 [ OK ] 32192 -=== AoC 2023 Day 14 [time: 1.297 sec; memory: 69 Mbytes] Parabolic Reflector Dish +=== AoC 2023 Day 14 [time: 1.673 sec; memory: 69 Mbytes] Parabolic Reflector Dish [ OK ] Puzzle example passed. [ OK ] 112048 [ OK ] 105606 -=== AoC 2023 Day 15 [time: 0.014 sec; memory: 67 Mbytes] Lens Library +=== AoC 2023 Day 15 [time: 0.019 sec; memory: 67 Mbytes] Lens Library [ OK ] Puzzle example passed. [ OK ] 517015 [ OK ] 286104 -=== AoC 2023 Day 16 [time: 1.375 sec; memory: 71 Mbytes] The Floor Will Be Lava +=== AoC 2023 Day 16 [time: 1.573 sec; memory: 71 Mbytes] The Floor Will Be Lava [ OK ] Puzzle example passed. [ OK ] 7472 [ OK ] 7716 -=== AoC 2023 Day 17 [time: 2.852 sec; memory: 148 Mbytes] Clumsy Crucible +=== AoC 2023 Day 17 [time: 3.302 sec; memory: 148 Mbytes] Clumsy Crucible [ OK ] Puzzle examples (2) passed. [ OK ] 684 [ OK ] 822 -=== AoC 2023 Day 18 [time: 0.287 sec; memory: 154 Mbytes] Lavaduct Lagoon +=== AoC 2023 Day 18 [time: 0.334 sec; memory: 154 Mbytes] Lavaduct Lagoon [ OK ] Puzzle example passed. [ OK ] 40131 [ OK ] 104454050898331 -=== AoC 2023 Day 19 [time: 0.028 sec; memory: 68 Mbytes] Aplenty +=== AoC 2023 Day 19 [time: 0.038 sec; memory: 68 Mbytes] Aplenty [ OK ] Puzzle example passed. [ OK ] 432434 [ OK ] 132557544578569 -=== AoC 2023 Day 20 [time: 0.411 sec; memory: 68 Mbytes] Pulse Propagation +=== AoC 2023 Day 20 [time: 0.438 sec; memory: 68 Mbytes] Pulse Propagation [ OK ] Puzzle examples (2) passed. [ OK ] 919383692 [ OK ] 247702167614647 -=== AoC 2023 Day 21 [time: 5.876 sec; memory: 273 Mbytes] Step Counter +=== AoC 2023 Day 21 [time: 5.977 sec; memory: 273 Mbytes] Step Counter [ OK ] Puzzle example passed. [ OK ] 3820 [ OK ] 632421652138917 -=== AoC 2023 Day 22 [time: 0.104 sec; memory: 71 Mbytes] Sand Slabs +=== AoC 2023 Day 22 [time: 0.102 sec; memory: 71 Mbytes] Sand Slabs [ OK ] Puzzle example passed. [ OK ] 434 [ OK ] 61209 === AoC 2023 Day 23 [WARN] Skipped. -=== AoC 2023 Day 24 [time: 0.414 sec; memory: 67 Mbytes] Never Tell Me The Odds +=== AoC 2023 Day 24 [time: 0.447 sec; memory: 67 Mbytes] Never Tell Me The Odds [ OK ] Puzzle example passed. [ OK ] 31208 [ OK ] 580043851566574 -=== AoC 2023 Day 25 [time: 0.009 sec; memory: 68 Mbytes] Snowverload +=== AoC 2023 Day 25 [time: 0.012 sec; memory: 68 Mbytes] Snowverload [ OK ] Puzzle example passed. [ OK ] 619225 -======= Total: 225 solutions (12 skipped) [time: 143.946 sec; max memory: 1610 MB] +======= Total: 225 solutions (12 skipped) [time: 118.820 sec; max memory: 1610 MB] [ OK ] All tests passed. ``` diff --git a/src/Aoc2015/Aoc2015Day03.php b/src/Aoc2015/Aoc2015Day03.php index a7f47d8..a104867 100644 --- a/src/Aoc2015/Aoc2015Day03.php +++ b/src/Aoc2015/Aoc2015Day03.php @@ -44,7 +44,7 @@ public function solve(array $input): array $memo = []; $x = 0; $y = 0; - $memo[$y][$x] = 1; + $memo[$y] = [$x => 1]; foreach (str_split($input) as $dir) { [$dx, $dy] = self::DELTAS[$dir] ?? [0, 0]; $x += $dx; @@ -59,7 +59,7 @@ public function solve(array $input): array $memo = []; $x = [0, 0]; $y = [0, 0]; - $memo[$y[0]][$x[0]] = 1; + $memo[$y[0]] = [$x[0] => 1]; foreach (str_split($input) as $idx => $dir) { [$dx, $dy] = self::DELTAS[$dir] ?? [0, 0]; $x[$idx % 2] += $dx; diff --git a/src/Aoc2015/Aoc2015Day22.php b/src/Aoc2015/Aoc2015Day22.php index 89d002f..253db1c 100644 --- a/src/Aoc2015/Aoc2015Day22.php +++ b/src/Aoc2015/Aoc2015Day22.php @@ -163,7 +163,7 @@ public function applyMove(int $spell): void $this->hp += self::SPELL_VALUES[self::SPELL_DRAIN]; $this->enemyHp = max(0, $this->enemyHp - self::SPELL_VALUES[self::SPELL_DRAIN]); } - if ((self::SPELL_DURATIONS[$spell] ?? 0) > 0) { + if (self::SPELL_DURATIONS[$spell] > 0) { $this->timers[$spell] = self::SPELL_DURATIONS[$spell]; } if ($this->enemyHp <= 0) { diff --git a/src/Aoc2016/Aoc2016Day01.php b/src/Aoc2016/Aoc2016Day01.php index 882519b..9dfa10b 100644 --- a/src/Aoc2016/Aoc2016Day01.php +++ b/src/Aoc2016/Aoc2016Day01.php @@ -57,7 +57,7 @@ public function solve(array $input): array $y = 0; $direction = 0; // N $memo = []; - $memo[$y][$x] = true; + $memo[$y] = [$x => true]; foreach (explode(', ', $input[0]) as $instruction) { $turn = self::TURNS[$instruction[0]] ?? 0; $move = intval(substr($instruction, 1)); diff --git a/src/Aoc2016/Aoc2016Day11.php b/src/Aoc2016/Aoc2016Day11.php index c77d8bd..797ca78 100644 --- a/src/Aoc2016/Aoc2016Day11.php +++ b/src/Aoc2016/Aoc2016Day11.php @@ -65,6 +65,8 @@ public function solve(array $input): array * Not used, too slow for Part 2. * * @codeCoverageIgnore + * + * @phpstan-ignore method.unused */ private function solveBFS(House $startState): int { diff --git a/src/Aoc2016/Aoc2016Day14.php b/src/Aoc2016/Aoc2016Day14.php index ac9375a..49e8945 100644 --- a/src/Aoc2016/Aoc2016Day14.php +++ b/src/Aoc2016/Aoc2016Day14.php @@ -27,8 +27,11 @@ final class Aoc2016Day14 extends SolutionBase public const EXAMPLE_SOLUTIONS = [[22728, 22551]]; public const EXAMPLE_STRING_INPUTS = ['abc', '']; + /** @var int */ private const MAX_DISTANCE = 1000; + /** @var int */ private const MAX_KEY = 64; + /** @var int */ private const REPEAT_PART2 = 2016; /** @var string */ private const HEX_DIGITS = '0123456789abcdef'; @@ -69,10 +72,12 @@ private function solvePart(string $salt, int $repeat = 0): int $this->lastSeenFive = []; for ($j = 0; $j < strlen(self::HEX_DIGITS); ++$j) { $digit = self::HEX_DIGITS[$j]; + // @phpstan-ignore assign.propertyType $this->lastSeenFive[$digit] = -1; $needle = str_repeat($digit, 5); for ($i = count($this->hashes) - 1; $i >= 0; --$i) { if (str_contains($this->hashes[$i], $needle)) { + // @phpstan-ignore assign.propertyType $this->lastSeenFive[$digit] = $i; break; } @@ -89,6 +94,7 @@ private function solvePart(string $salt, int $repeat = 0): int for ($j = 0; $j < strlen(self::HEX_DIGITS); ++$j) { $digit = self::HEX_DIGITS[$j]; if (str_contains($hash, str_repeat($digit, 5))) { + // @phpstan-ignore assign.propertyType $this->lastSeenFive[$digit] = $idx + self::MAX_DISTANCE; } } diff --git a/src/Aoc2016/Aoc2016Day22.php b/src/Aoc2016/Aoc2016Day22.php index 6a5f2b1..5837aba 100644 --- a/src/Aoc2016/Aoc2016Day22.php +++ b/src/Aoc2016/Aoc2016Day22.php @@ -92,6 +92,8 @@ public function solve(array $input): array /** * @codeCoverageIgnore + * + * @phpstan-ignore method.unused */ private function printGrid(): void { diff --git a/src/Aoc2017/Aoc2017Day03.php b/src/Aoc2017/Aoc2017Day03.php index 5433a55..fbd557d 100644 --- a/src/Aoc2017/Aoc2017Day03.php +++ b/src/Aoc2017/Aoc2017Day03.php @@ -51,7 +51,8 @@ public function solve(array $input): array [$x, $y] = [0, 0]; [$dx, $dy] = [1, 0]; $ans2 = 1; - $memo[$y][$x] = $ans2; + $memo = []; + $memo[$y] = [$x => $ans2]; while ($ans2 <= $n) { $x += $dx; $y += $dy; diff --git a/src/Aoc2017/Aoc2017Day21.php b/src/Aoc2017/Aoc2017Day21.php index f7b57d3..3f0beda 100644 --- a/src/Aoc2017/Aoc2017Day21.php +++ b/src/Aoc2017/Aoc2017Day21.php @@ -150,6 +150,8 @@ private static function getOrientations(string $image): array /** * @codeCoverageIgnore + * + * @phpstan-ignore method.unused */ private static function printImage(string $image): void { diff --git a/src/Aoc2018/Aoc2018Day21.php b/src/Aoc2018/Aoc2018Day21.php index 620c582..b05327a 100644 --- a/src/Aoc2018/Aoc2018Day21.php +++ b/src/Aoc2018/Aoc2018Day21.php @@ -133,6 +133,8 @@ public function solve(array $input): array * @return array The registers after executing the instruction * * @codeCoverageIgnore + * + * @phpstan-ignore method.unused */ private static function execute(array $instr, array $regs): array { diff --git a/src/Aoc2018/Aoc2018Day23.php b/src/Aoc2018/Aoc2018Day23.php index 715e302..2a7c5fb 100644 --- a/src/Aoc2018/Aoc2018Day23.php +++ b/src/Aoc2018/Aoc2018Day23.php @@ -119,7 +119,6 @@ public function __construct( public function manhattanToOrigo(): int { - // @phpstan-ignore argument.type return intval(array_sum(array_map(abs(...), $this->p))); } } @@ -147,7 +146,6 @@ public function inRange(Point $point): bool public function maxRangeCoord(): int { - // @phpstan-ignore argument.type return intval(max(array_map(abs(...), $this->p))) + $this->r; } diff --git a/src/Aoc2018/Aoc2018Day24.php b/src/Aoc2018/Aoc2018Day24.php index d38bf47..05b7361 100644 --- a/src/Aoc2018/Aoc2018Day24.php +++ b/src/Aoc2018/Aoc2018Day24.php @@ -101,6 +101,7 @@ private function simulate(array $groups): array { $aliveGroups = $groups; $totalKills = 0; + $sides = []; while (true) { // eliminate killed groups $aliveGroups = array_filter( @@ -289,16 +290,21 @@ public static function fromString(string $s, int $id, int $type): self $closePar = $pos - 1; } $sub = substr($s, 0, $openPar); - $count1 = sscanf($sub, '%d units each with %d hit points ', $g->startUnits, $g->hp); + $count1 = sscanf($sub, '%d units each with %d hit points ', $startUnits, $hp); + $g->startUnits = intval($startUnits); + $g->hp = intval($hp); $g->units = $g->startUnits; $sub = substr($s, $closePar + 1); $count2 = sscanf( $sub, ' with an attack that does %d %s damage at initiative %d', - $g->damage, - $g->damageType, - $g->initiative + $damage, + $damageType, + $initiative ); + $g->damage = intval($damage); + $g->damageType = strval($damageType); + $g->initiative = intval($initiative); if (($count1 != 2) or ($count2 != 3)) { throw new \Exception('Invalid input'); } diff --git a/src/Aoc2019/Aoc2019Day05.php b/src/Aoc2019/Aoc2019Day05.php index d7db481..f324b4e 100644 --- a/src/Aoc2019/Aoc2019Day05.php +++ b/src/Aoc2019/Aoc2019Day05.php @@ -82,9 +82,10 @@ private function simulate(array $memory, array $inputs): int 2 => $memory[$memory[$ic + 3]] = $params[1] * $params[2], 3 => $memory[$memory[$ic + 1]] = $inputs[$idxInput++] ?? throw new \Exception('Invalid input'), 4 => $output[] = $params[1], - 5 => $ic = $params[1] != 0 ? $params[2] : $ic, - 6 => $ic = $params[1] == 0 ? $params[2] : $ic, + 5 => $ic = $params[1] != 0 ? intval($params[2]) : $ic, + 6 => $ic = $params[1] == 0 ? intval($params[2]) : $ic, 7 => $memory[$memory[$ic + 3]] = $params[1] < $params[2] ? 1 : 0, + // @phpstan-ignore match.alwaysTrue 8 => $memory[$memory[$ic + 3]] = $params[1] == $params[2] ? 1 : 0, default => throw new \Exception('Invalid input'), }; diff --git a/src/Aoc2019/Aoc2019Day07.php b/src/Aoc2019/Aoc2019Day07.php index 9c49981..80b069e 100644 --- a/src/Aoc2019/Aoc2019Day07.php +++ b/src/Aoc2019/Aoc2019Day07.php @@ -209,6 +209,7 @@ public function simulate(): void 5 => $this->ic = $params[1] != 0 ? $params[2] : $this->ic, 6 => $this->ic = $params[1] == 0 ? $params[2] : $this->ic, 7 => $this->memory[$this->memory[$this->ic + 3]] = $params[1] < $params[2] ? 1 : 0, + // @phpstan-ignore match.alwaysTrue 8 => $this->memory[$this->memory[$this->ic + 3]] = $params[1] == $params[2] ? 1 : 0, default => throw new \Exception('Invalid input'), }; diff --git a/src/Aoc2019/Aoc2019Day09.php b/src/Aoc2019/Aoc2019Day09.php index b894e20..bcd81ea 100644 --- a/src/Aoc2019/Aoc2019Day09.php +++ b/src/Aoc2019/Aoc2019Day09.php @@ -117,6 +117,7 @@ public function simulate(): void 6 => $this->ic = $params[1] == 0 ? $params[2] : $this->ic, 7 => $this->memory[$addresses[3]] = $params[1] < $params[2] ? 1 : 0, 8 => $this->memory[$addresses[3]] = $params[1] == $params[2] ? 1 : 0, + // @phpstan-ignore match.alwaysTrue 9 => $this->relBase += $params[1], default => throw new \Exception('Invalid input'), }; diff --git a/src/Aoc2019/Aoc2019Day11.php b/src/Aoc2019/Aoc2019Day11.php index 41b5d52..f8b9e7c 100644 --- a/src/Aoc2019/Aoc2019Day11.php +++ b/src/Aoc2019/Aoc2019Day11.php @@ -170,6 +170,7 @@ public function simulate(): void 6 => $this->ic = $params[1] == 0 ? $params[2] : $this->ic, 7 => $this->memory[$addresses[3]] = $params[1] < $params[2] ? 1 : 0, 8 => $this->memory[$addresses[3]] = $params[1] == $params[2] ? 1 : 0, + // @phpstan-ignore match.alwaysTrue 9 => $this->relBase += $params[1], default => throw new \Exception('Invalid input'), }; diff --git a/src/Aoc2019/Aoc2019Day13.php b/src/Aoc2019/Aoc2019Day13.php index 1323e74..569cb7e 100644 --- a/src/Aoc2019/Aoc2019Day13.php +++ b/src/Aoc2019/Aoc2019Day13.php @@ -222,6 +222,7 @@ public function simulate(): void 6 => $this->ic = $params[1] == 0 ? $params[2] : $this->ic, 7 => $this->memory[$addresses[3]] = $params[1] < $params[2] ? 1 : 0, 8 => $this->memory[$addresses[3]] = $params[1] == $params[2] ? 1 : 0, + // @phpstan-ignore match.alwaysTrue 9 => $this->relBase += $params[1], default => throw new \Exception('Invalid input'), }; diff --git a/src/Aoc2019/Aoc2019Day15.php b/src/Aoc2019/Aoc2019Day15.php index 1249575..d74e4ca 100644 --- a/src/Aoc2019/Aoc2019Day15.php +++ b/src/Aoc2019/Aoc2019Day15.php @@ -299,6 +299,7 @@ public function simulate(): void 6 => $this->ic = $params[1] == 0 ? $params[2] : $this->ic, 7 => $this->memory[$addresses[3]] = $params[1] < $params[2] ? 1 : 0, 8 => $this->memory[$addresses[3]] = $params[1] == $params[2] ? 1 : 0, + // @phpstan-ignore match.alwaysTrue 9 => $this->relBase += $params[1], default => throw new \Exception('Invalid input'), }; diff --git a/src/Aoc2019/Aoc2019Day17.php b/src/Aoc2019/Aoc2019Day17.php index 13938d5..f8c92f6 100644 --- a/src/Aoc2019/Aoc2019Day17.php +++ b/src/Aoc2019/Aoc2019Day17.php @@ -261,6 +261,7 @@ public function simulate(): void 6 => $this->ic = $params[1] == 0 ? $params[2] : $this->ic, 7 => $this->memory[$addresses[3]] = $params[1] < $params[2] ? 1 : 0, 8 => $this->memory[$addresses[3]] = $params[1] == $params[2] ? 1 : 0, + // @phpstan-ignore match.alwaysTrue 9 => $this->relBase += $params[1], default => throw new \Exception('Invalid input'), }; diff --git a/src/Aoc2019/Aoc2019Day18.php b/src/Aoc2019/Aoc2019Day18.php index 179ed3c..9ea72cf 100644 --- a/src/Aoc2019/Aoc2019Day18.php +++ b/src/Aoc2019/Aoc2019Day18.php @@ -112,7 +112,7 @@ private function solvePart1(array $grid, int $robotHash, int $maxKeys, int $maxR { $targetKeys = (1 << $maxKeys) - 1; $visited = []; - $visited[0][$robotHash] = true; + $visited[0] = [$robotHash => true]; $q = [[$robotHash, 0, 0]]; $readIdx = 0; while (true) { @@ -163,7 +163,7 @@ private function solvePart1(array $grid, int $robotHash, int $maxKeys, int $maxR private function solvePart2(array $grid, int $robotHash): int { $visited = []; - $visited[0][$robotHash] = true; + $visited[0] = [$robotHash => true]; $q = [[$robotHash, 0, 0, 0]]; $maxKeys = 0; $maxSteps = 0; diff --git a/src/Aoc2019/Aoc2019Day19.php b/src/Aoc2019/Aoc2019Day19.php index 8da62ad..15630e7 100644 --- a/src/Aoc2019/Aoc2019Day19.php +++ b/src/Aoc2019/Aoc2019Day19.php @@ -176,6 +176,7 @@ public function simulate(): void 6 => $this->ic = $params[1] == 0 ? $params[2] : $this->ic, 7 => $this->memory[$addresses[3]] = $params[1] < $params[2] ? 1 : 0, 8 => $this->memory[$addresses[3]] = $params[1] == $params[2] ? 1 : 0, + // @phpstan-ignore match.alwaysTrue 9 => $this->relBase += $params[1], default => throw new \Exception('Invalid input'), }; diff --git a/src/Aoc2019/Aoc2019Day21.php b/src/Aoc2019/Aoc2019Day21.php index 2fad613..483e598 100644 --- a/src/Aoc2019/Aoc2019Day21.php +++ b/src/Aoc2019/Aoc2019Day21.php @@ -148,6 +148,7 @@ public function simulate(): void 6 => $this->ic = $params[1] == 0 ? $params[2] : $this->ic, 7 => $this->memory[$addresses[3]] = $params[1] < $params[2] ? 1 : 0, 8 => $this->memory[$addresses[3]] = $params[1] == $params[2] ? 1 : 0, + // @phpstan-ignore match.alwaysTrue 9 => $this->relBase += $params[1], default => throw new \Exception('Invalid input'), }; diff --git a/src/Aoc2019/Aoc2019Day23.php b/src/Aoc2019/Aoc2019Day23.php index 0bd32c0..170c992 100644 --- a/src/Aoc2019/Aoc2019Day23.php +++ b/src/Aoc2019/Aoc2019Day23.php @@ -158,6 +158,7 @@ public function simulate(): void 6 => $this->ic = $params[1] == 0 ? $params[2] : $this->ic, 7 => $this->memory[$addresses[3]] = $params[1] < $params[2] ? 1 : 0, 8 => $this->memory[$addresses[3]] = $params[1] == $params[2] ? 1 : 0, + // @phpstan-ignore match.alwaysTrue 9 => $this->relBase += $params[1], default => throw new \Exception('Invalid input'), }; diff --git a/src/Aoc2019/Aoc2019Day25.php b/src/Aoc2019/Aoc2019Day25.php index cfa2271..a81c15d 100644 --- a/src/Aoc2019/Aoc2019Day25.php +++ b/src/Aoc2019/Aoc2019Day25.php @@ -243,6 +243,7 @@ public function simulate(): void 6 => $this->ic = $params[1] == 0 ? $params[2] : $this->ic, 7 => $this->memory[$addresses[3]] = $params[1] < $params[2] ? 1 : 0, 8 => $this->memory[$addresses[3]] = $params[1] == $params[2] ? 1 : 0, + // @phpstan-ignore match.alwaysTrue 9 => $this->relBase += $params[1], default => throw new \Exception('Invalid input'), }; diff --git a/src/Aoc2020/Aoc2020Day06.php b/src/Aoc2020/Aoc2020Day06.php index 321f23e..19766ba 100644 --- a/src/Aoc2020/Aoc2020Day06.php +++ b/src/Aoc2020/Aoc2020Day06.php @@ -47,7 +47,6 @@ public function solve(array $input): array // ---------- Part 1 $ans1 = array_sum(array_map( // count_chars mode = 3: a string containing all unique characters is returned. - // @phpstan-ignore argument.type static fn (array $group): int => strlen(count_chars(implode('', $group), 3)), $processedInput )); @@ -56,7 +55,6 @@ public function solve(array $input): array // count_chars mode = 1: an array with the byte-value as key and the frequency of every byte as value, // only byte-values with a frequency greater than zero are listed. static fn (array $group): int => count(array_filter( - // @phpstan-ignore argument.type count_chars(implode('', $group), 1), static fn (int $value): bool => $value == count($group), )), diff --git a/src/Aoc2020/Aoc2020Day13.php b/src/Aoc2020/Aoc2020Day13.php index cfcf481..6153639 100644 --- a/src/Aoc2020/Aoc2020Day13.php +++ b/src/Aoc2020/Aoc2020Day13.php @@ -104,6 +104,8 @@ public function solve(array $input): array * @phpstan-return array{int, int, int} * * @codeCoverageIgnore + * + * @phpstan-ignore method.unused */ private static function extendedEuclidean(int $a, int $b): array { diff --git a/src/Aoc2021/Aoc2021Day18.php b/src/Aoc2021/Aoc2021Day18.php index 3aa73bd..17cd20e 100644 --- a/src/Aoc2021/Aoc2021Day18.php +++ b/src/Aoc2021/Aoc2021Day18.php @@ -206,7 +206,7 @@ public function explode(): bool if ($current === $node) { $isNodePassed = true; } - if ($current?->isRegular) { + if ($current->isRegular) { if ($current->parent !== $node) { if (!$isNodePassed) { $leftRegularNode = $current; @@ -215,7 +215,7 @@ public function explode(): bool } } } - $current = $current?->right; + $current = $current->right; } } if (!is_null($leftRegularNode)) { @@ -344,6 +344,8 @@ public static function add(self $a, self $b): self /** * @codeCoverageIgnore + * + * @phpstan-ignore method.unused */ private function unitTest(): void { diff --git a/src/Aoc2021/Aoc2021Day19.php b/src/Aoc2021/Aoc2021Day19.php index 9c7adc6..4e325fe 100644 --- a/src/Aoc2021/Aoc2021Day19.php +++ b/src/Aoc2021/Aoc2021Day19.php @@ -39,7 +39,7 @@ public function solve(array $input): array { // ---------- Parse input $scanners = []; - /** @var array $scanners */ + /** @var array> $scanners */ $maxScanners = 0; foreach ($input as $line) { if ($line == '') { @@ -87,7 +87,7 @@ public function solve(array $input): array if (!isset($foundScanner[$id1])) { continue; } - $scanner1 = $rotScanners[$id1][$scannerRotations[$id1] ?? throw new \Exception('Impossible')]; + $scanner1 = $rotScanners[$id1][$scannerRotations[$id1]]; for ($id2 = 0; $id2 < $maxScanners; ++$id2) { if (isset($foundScanner[$id2])) { continue; diff --git a/src/Aoc2021/Aoc2021Day22.php b/src/Aoc2021/Aoc2021Day22.php index d07cc7c..56b3685 100644 --- a/src/Aoc2021/Aoc2021Day22.php +++ b/src/Aoc2021/Aoc2021Day22.php @@ -80,6 +80,7 @@ public function solve(array $input): array for ($idxY = $posFrom[1]; $idxY < $posTo[1]; ++$idxY) { for ($idxZ = $posFrom[2]; $idxZ < $posTo[2]; ++$idxZ) { $pos = $idxX * count($dividers[1]) * count($dividers[2]) + $idxY * count($dividers[2]) + $idxZ; + // @phpstan-ignore-next-line offsetAccess.nonOffsetAccessible $regionOn[$pos] = $c->isOn ? '1' : '0'; } } @@ -89,6 +90,7 @@ public function solve(array $input): array for ($idxY = 0; $idxY < count($dividers[1]) - 1; ++$idxY) { for ($idxZ = 0; $idxZ < count($dividers[2]) - 1; ++$idxZ) { $pos = $idxX * count($dividers[1]) * count($dividers[2]) + $idxY * count($dividers[2]) + $idxZ; + // @phpstan-ignore-next-line offsetAccess.nonOffsetAccessible if ($regionOn[$pos] != '1') { continue; } @@ -131,16 +133,13 @@ public static function fromString(string $inputLine): self $c->isOn = false; $s = substr($inputLine, 4); } - $count = sscanf( - $s, - 'x=%d..%d,y=%d..%d,z=%d..%d', - $c->from[0], - $c->to[0], - $c->from[1], - $c->to[1], - $c->from[2], - $c->to[2], - ); + $count = sscanf($s, 'x=%d..%d,y=%d..%d,z=%d..%d', $f0, $t0, $f1, $t1, $f2, $t2); + $c->from[0] = intval($f0); + $c->to[0] = intval($t0); + $c->from[1] = intval($f1); + $c->to[1] = intval($t1); + $c->from[2] = intval($f2); + $c->to[2] = intval($t2); if (($count != 6) or ($c->from[0] > $c->to[0]) or ($c->from[1] > $c->to[1]) or ($c->from[2] > $c->to[2])) { throw new \Exception('Invalid input'); } diff --git a/src/Aoc2021/Aoc2021Day23.php b/src/Aoc2021/Aoc2021Day23.php index 991ac63..3fd44ff 100644 --- a/src/Aoc2021/Aoc2021Day23.php +++ b/src/Aoc2021/Aoc2021Day23.php @@ -68,9 +68,9 @@ public function solvePart(Burrow $burrow, int $startStateRoom, int $startStateHa $ans = 0; $prevStates = []; $bestCosts = []; + $bestCosts[$startStateRoom] = [$startStateHallway => 0]; $costMoves = []; - $bestCosts[$startStateRoom][$startStateHallway] = 0; - $costMoves[$startStateRoom][$startStateHallway] = 0; + $costMoves[$startStateRoom] = [$startStateHallway => 0]; $pq = new MinPriorityQueue(); $pq->setExtractFlags(\SplPriorityQueue::EXTR_BOTH); $pq->insert([$startStateRoom, $startStateHallway], 0); @@ -127,17 +127,19 @@ class Burrow // 2 ###0#2#4#6### // 3 #1#3#5#7# // 4 ######### - public const INPUT_LINES = 5; - public const MAX_CELLS = 15; - public const MAX_ROOMS = 8; - public const BITS_PER_CELL = 3; - public const MASK_CELL = (1 << self::BITS_PER_CELL) - 1; - public const CHAR_TO_AMPHIPOD = ['.' => 0, 'A' => 1, 'B' => 2, 'C' => 3, 'D' => 4]; - public const AMPHIPOD_TO_CHAR = '.ABCD'; - public const COSTS = [0, 1, 10, 100, 1000]; - public const HALLWAY_Y = 1; + public const int INPUT_LINES = 5; + public const int MAX_CELLS = 15; + public const int MAX_ROOMS = 8; + public const int BITS_PER_CELL = 3; + public const int MASK_CELL = (1 << self::BITS_PER_CELL) - 1; + /** @var array */ + public const array CHAR_TO_AMPHIPOD = ['.' => 0, 'A' => 1, 'B' => 2, 'C' => 3, 'D' => 4]; + public const string AMPHIPOD_TO_CHAR = '.ABCD'; + /** @var array */ + public const array COSTS = [0, 1, 10, 100, 1000]; + public const int HALLWAY_Y = 1; /** @var array */ - public const TARGET_INPUT = [ + public const array TARGET_INPUT = [ '#############', '#...........#', '###A#B#C#D###', @@ -382,11 +384,11 @@ class BurrowExtended extends Burrow // 4 #2#6#0#4# // 5 #3#7#1#5# // 4 ######### - public const INPUT_LINES = 7; - public const MAX_CELLS = 23; - public const MAX_ROOMS = 16; + public const int INPUT_LINES = 7; + public const int MAX_CELLS = 23; + public const int MAX_ROOMS = 16; /** @var array */ - public const TARGET_INPUT = [ + public const array TARGET_INPUT = [ '#############', '#...........#', '###A#B#C#D###', diff --git a/src/Aoc2022/Aoc2022Day06.php b/src/Aoc2022/Aoc2022Day06.php index 859bc37..80b1ffa 100644 --- a/src/Aoc2022/Aoc2022Day06.php +++ b/src/Aoc2022/Aoc2022Day06.php @@ -48,7 +48,6 @@ private function solvePart(string $data, int $markerWidth): int for ($i = $markerWidth; $i <= strlen($data); ++$i) { $cand = substr($data, $i - $markerWidth, $markerWidth); // count_chars mode = 3: a string containing all unique characters is returned. - // @phpstan-ignore argument.type if (strlen(count_chars($cand, 3)) == $markerWidth) { return $i; } diff --git a/src/Aoc2022/Aoc2022Day14.php b/src/Aoc2022/Aoc2022Day14.php index 91d7146..00ae967 100644 --- a/src/Aoc2022/Aoc2022Day14.php +++ b/src/Aoc2022/Aoc2022Day14.php @@ -77,7 +77,7 @@ public function solve(array $input): array $canFall = false; foreach ([[0, 1], [-1, 1], [1, 1]] as [$dx, $dy]) { [$x1, $y1] = [$x + $dx, $y + $dy]; - // @phpstan-ignore isset.offset + // @phpstan-ignore isset.offset, offsetAccess.nonOffsetAccessible if (!isset($walls[$y1][$x1]) and !isset($sands[$y1][$x1])) { $canFall = true; break; diff --git a/src/Aoc2022/Aoc2022Day15.php b/src/Aoc2022/Aoc2022Day15.php index 65ccd56..01d5ea2 100644 --- a/src/Aoc2022/Aoc2022Day15.php +++ b/src/Aoc2022/Aoc2022Day15.php @@ -165,15 +165,19 @@ public static function fromString(string $s): self $count = sscanf( $s, 'Sensor at x=%d, y=%d: closest beacon is at x=%d, y=%d', - $sensor->x, - $sensor->y, - $sensor->beaconX, - $sensor->beaconY, + $x, + $y, + $beaconX, + $beaconY, ); + $sensor->x = intval($x); + $sensor->y = intval($y); + $sensor->beaconX = intval($beaconX); + $sensor->beaconY = intval($beaconY); if ($count != 4) { throw new \Exception('Invalid input'); } - $sensor->distance = abs($sensor->x - $sensor->beaconX) + abs($sensor->y - $sensor->beaconY); + $sensor->distance = intval(abs($sensor->x - $sensor->beaconX) + abs($sensor->y - $sensor->beaconY)); return $sensor; } } diff --git a/src/Aoc2022/Aoc2022Day17.php b/src/Aoc2022/Aoc2022Day17.php index 33d16bb..9c4fd09 100644 --- a/src/Aoc2022/Aoc2022Day17.php +++ b/src/Aoc2022/Aoc2022Day17.php @@ -55,24 +55,27 @@ public function solve(array $input): array // -------------------------------------------------------------------- abstract class Rock { - public const MAX_X = 1; - public const MAX_Y = 1; - public const SHAPE = [0b1]; + public const int MAX_X = 1; + public const int MAX_Y = 1; + /** @var array */ + public const array SHAPE = [0b1]; } // -------------------------------------------------------------------- final class HorizontalRock extends Rock { - public const MAX_X = 4; - public const MAX_Y = 1; - public const SHAPE = [0b1111]; + public const int MAX_X = 4; + public const int MAX_Y = 1; + /** @var array */ + public const array SHAPE = [0b1111]; } final class CrossRock extends Rock { - public const MAX_X = 3; - public const MAX_Y = 3; - public const SHAPE = [ + public const int MAX_X = 3; + public const int MAX_Y = 3; + /** @var array */ + public const array SHAPE = [ 0b010, 0b111, 0b010, @@ -81,9 +84,10 @@ final class CrossRock extends Rock final class LRock extends Rock { - public const MAX_X = 3; - public const MAX_Y = 3; - public const SHAPE = [ + public const int MAX_X = 3; + public const int MAX_Y = 3; + /** @var array */ + public const array SHAPE = [ 0b111, 0b100, 0b100, @@ -92,9 +96,10 @@ final class LRock extends Rock final class VerticalRock extends Rock { - public const MAX_X = 1; - public const MAX_Y = 4; - public const SHAPE = [ + public const int MAX_X = 1; + public const int MAX_Y = 4; + /** @var array */ + public const array SHAPE = [ 0b1, 0b1, 0b1, @@ -104,9 +109,10 @@ final class VerticalRock extends Rock final class SquareRock extends Rock { - public const MAX_X = 2; - public const MAX_Y = 2; - public const SHAPE = [ + public const int MAX_X = 2; + public const int MAX_Y = 2; + /** @var array */ + public const array SHAPE = [ 0b11, 0b11, ]; @@ -115,7 +121,7 @@ final class SquareRock extends Rock // -------------------------------------------------------------------- class Pit { - public const DEBUG = false; + public const bool DEBUG = false; public readonly int $maxX; public int $maxY = 0; diff --git a/src/Aoc2022/Aoc2022Day19.php b/src/Aoc2022/Aoc2022Day19.php index 6500111..b2b441e 100644 --- a/src/Aoc2022/Aoc2022Day19.php +++ b/src/Aoc2022/Aoc2022Day19.php @@ -119,14 +119,21 @@ public static function fromString(string $s): self $s, 'Blueprint %d: Each ore robot costs %d ore. Each clay robot costs %d ore. ' . 'Each obsidian robot costs %d ore and %d clay. Each geode robot costs %d ore and %d obsidian.', - $b->id, - $b->oreRobotOreCost, - $b->clayRobotOreCost, - $b->obsidianRobotOreCost, - $b->obsidianRobotClayCost, - $b->geodeRobotOreCost, - $b->geodeRobotObsidianCost, + $id, + $oreRobotOreCost, + $clayRobotOreCost, + $obsidianRobotOreCost, + $obsidianRobotClayCost, + $geodeRobotOreCost, + $geodeRobotObsidianCost, ); + $b->id = intval($id); + $b->oreRobotOreCost = intval($oreRobotOreCost); + $b->clayRobotOreCost = intval($clayRobotOreCost); + $b->obsidianRobotOreCost = intval($obsidianRobotOreCost); + $b->obsidianRobotClayCost = intval($obsidianRobotClayCost); + $b->geodeRobotOreCost = intval($geodeRobotOreCost); + $b->geodeRobotObsidianCost = intval($geodeRobotObsidianCost); if ($count != 7) { throw new \Exception('Invalid input'); } diff --git a/src/Aoc2023/Aoc2023Day01.php b/src/Aoc2023/Aoc2023Day01.php index bc58bf6..b3715de 100644 --- a/src/Aoc2023/Aoc2023Day01.php +++ b/src/Aoc2023/Aoc2023Day01.php @@ -50,6 +50,7 @@ public function solve(array $input): array { // ---------- Part 1 + 2 $fnDigits = static fn (array $a): array => array_map( + // @phpstan-ignore-next-line argument.type static fn (string $s): string => implode('', array_filter( str_split($s), static fn (string $c): bool => $c >= '0' && $c <= '9', @@ -57,6 +58,7 @@ public function solve(array $input): array $a, ); $fnSumBorder = static fn (array $a): int => array_sum(array_map( + // @phpstan-ignore-next-line argument.type static fn (string $s): int => 10 * intval($s[0] ?? '0') + intval($s[-1] ?? '0'), $a, )); diff --git a/src/Aoc2023/Aoc2023Day14.php b/src/Aoc2023/Aoc2023Day14.php index 90e5fd8..a62f2ee 100644 --- a/src/Aoc2023/Aoc2023Day14.php +++ b/src/Aoc2023/Aoc2023Day14.php @@ -24,7 +24,7 @@ final class Aoc2023Day14 extends SolutionBase public const SOLUTIONS = [112048, 105606]; public const EXAMPLE_SOLUTIONS = [[136, 64]]; - private const MAX_STEPS_PART2 = 1_000_000_000; + private const int MAX_STEPS_PART2 = 1_000_000_000; private int $maxX = 0; private int $maxY = 0; @@ -119,7 +119,8 @@ private function tiltNorth(): void $newY = 0; foreach ($this->fixRocksAtX[$x] as [$x1, $y1]) { if (($y1 < $y) and ($y1 >= $newY)) { - $newY = $y1 + 1; + // @phpstan-ignore-next-line argument.type + $newY = intval($y1) + 1; } } while ($this->grid[$newY][$x] == 'O') { @@ -141,13 +142,13 @@ private function tiltWest(): void $newX = 0; foreach ($this->fixRocksAtY[$y] as [$x1, $y1]) { if (($x1 < $x) and ($x1 >= $newX)) { - $newX = $x1 + 1; + // @phpstan-ignore-next-line argument.type + $newX = intval($x1) + 1; } } while ($this->grid[$y][$newX] == 'O') { ++$newX; } - // @phpstan-ignore assign.propertyType $this->grid[$y][$newX] = 'O'; } } @@ -164,7 +165,8 @@ private function tiltSouth(): void $newY = $this->maxY - 1; foreach ($this->fixRocksAtX[$x] as [$x1, $y1]) { if (($y1 > $y) and ($y1 <= $newY)) { - $newY = $y1 - 1; + // @phpstan-ignore-next-line argument.type + $newY = intval($y1) - 1; } } while ($this->grid[$newY][$x] == 'O') { @@ -186,13 +188,13 @@ private function tiltEast(): void $newX = $this->maxX - 1; foreach ($this->fixRocksAtY[$y] as [$x1, $y1]) { if (($x1 > $x) and ($x1 <= $newX)) { - $newX = $x1 - 1; + // @phpstan-ignore-next-line argument.type + $newX = intval($x1) - 1; } } while ($this->grid[$y][$newX] == 'O') { --$newX; } - // @phpstan-ignore assign.propertyType $this->grid[$y][$newX] = 'O'; } }