This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env raku | |
| use v6.d; | |
| $*OUT.out-buffer = False; # Autoflush | |
| # Advent of Code 2024 day 11 -- https://adventofcode.com/2024/day/11 | |
| class MagicStones | |
| { | |
| has Int @.stones; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env raku | |
| use v6.d; | |
| $*OUT.out-buffer = False; # Autoflush | |
| # Advent of Code 2024 day 11 -- https://adventofcode.com/2024/day/11 | |
| sub split-in-half($n) { $n.comb(/\w ** { $n.chars div 2 }/)».Int } | |
| use experimental :cached; | |
| multi blink($stone, $times) is cached |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env raku | |
| use v6.d; | |
| $*OUT.out-buffer = False; # Autoflush | |
| # Advent of Code 2024 day 12 -- https://adventofcode.com/2024/day/12 | |
| enum Direction <north east south west>; | |
| sub left(Direction $d --> Direction) { Direction(($d - 1) % 4) } | |
| sub right(Direction $d --> Direction) { Direction(($d + 1) % 4) } | |
| sub turn(Direction $d --> Direction) { Direction(($d + 2) % 4) } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env raku | |
| use v6.d; | |
| $*OUT.out-buffer = False; # Autoflush | |
| # Advent of Code 2024 day 13 -- https://adventofcode.com/2024/day/13 | |
| sub button-presses($ax,$ay, $bx,$by, $px,$py) | |
| { | |
| # We need to find (non-negative integer) m and n so that | |
| # m × (ax,ay) + n × (bx,by) = (px,py) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env raku | |
| use v6.d; | |
| $*OUT.out-buffer = False; # Autoflush | |
| # Advent of Code 2024 day 14 -- https://adventofcode.com/2024/day/14 | |
| class Vector | |
| { | |
| has Int $.x; | |
| has Int $.y; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env raku | |
| use v6.d; | |
| $*OUT.out-buffer = False; # Autoflush | |
| # Advent of Code 2024 day 15 -- https://adventofcode.com/2024/day/15 | |
| enum Direction <north east south west>; | |
| sub left(Direction $d --> Direction) { Direction(($d - 1) % 4) } | |
| sub right(Direction $d --> Direction) { Direction(($d + 1) % 4) } | |
| sub turn(Direction $d --> Direction) { Direction(($d + 2) % 4) } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env raku | |
| use v6.d; | |
| $*OUT.out-buffer = False; # Autoflush | |
| # Advent of Code 2024 day 19 -- https://adventofcode.com/2024/day/19 | |
| class TowelArranger | |
| { | |
| has @.towels; | |
| has @.designs; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env raku | |
| use v6.d; | |
| $*OUT.out-buffer = False; # Autoflush | |
| # Advent of Code 2025 day 1 -- https://adventofcode.com/2025/day/1 | |
| class Safe | |
| { | |
| has Int $.modulo = 100; | |
| has Int $.dial = $!modulo div 2; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env raku | |
| use v6.d; | |
| $*OUT.out-buffer = False; # Autoflush | |
| # Advent of Code 2025 day 1 -- https://adventofcode.com/2025/day/1 | |
| class Safe | |
| { | |
| has Int $.modulo = 100; | |
| has Int $.dial = $!modulo div 2; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env raku | |
| use v6.d; | |
| $*OUT.out-buffer = False; # Autoflush | |
| # Advent of Code 2025 day 2 -- https://adventofcode.com/2025/day/2 | |
| unit sub MAIN(IO() $inputfile where *.f = 'aoc02.input', Bool :v($verbose) = False); | |
| # Find invalid IDs in a list of ranges | |
| multi invalid-ids(Str $ranges, Bool :$simple = False) |