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 7 -- https://adventofcode.com/2024/day/7 | |
| sub infix:<∥>(Int $i, Int $j --> Int) | |
| { | |
| # Slightly faster than ($i~$j).Int | |
| return 10*$i + $j if $j < 10; |
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 7 -- https://adventofcode.com/2024/day/7 | |
| sub infix:<∥>(Int $i, Int $j --> Int) { ($i ~ $j).Int } | |
| sub valid-equation($equation) | |
| { |
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 6 -- https://adventofcode.com/2024/day/6 | |
| enum Direction <north east south west>; | |
| sub left(Direction $d --> Direction) { Direction(($d - 1) % 4) } | |
| sub right(Direction $d --> Direction) { Direction(($d + 1) % 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 5 -- https://adventofcode.com/2024/day/5 | |
| class Printer | |
| { | |
| has $.input; |
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 4 -- https://adventofcode.com/2024/day/4 | |
| class WordFinder | |
| { | |
| has @.grid; |
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; | |
| class SnakesAndLadders | |
| { | |
| enum OvershootRules <StepBack StandStill>; | |
| #constant $START-POS = 1; | |
| #constant $WIN-POS = 64; | |
| #constant %SNAKES = 23=>4, 30=>10, 42=>9, 49=>15, 54=>20, 61=>46; |
NewerOlder