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; |
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; | |
| $*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 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 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 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) | |
| { | |
| # 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 8 -- https://adventofcode.com/2024/day/8 | |
| class Position | |
| { | |
| 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 9 -- https://adventofcode.com/2024/day/9 | |
| class DiskMap | |
| { | |
| has $.map; |
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 10 -- https://adventofcode.com/2024/day/10 | |
| enum Direction <north east south west>; | |
| class Position | |
| { |
OlderNewer