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 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 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 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 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 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 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 10 -- https://adventofcode.com/2024/day/10 | |
enum Direction <north east south west>; | |
class Position | |
{ |
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 8 -- https://adventofcode.com/2024/day/8 | |
class Position | |
{ | |
has Int $.x; | |
has Int $.y; |
NewerOlder