Quick actions

cmd+k|ctrl+k

Navigation

Languages

Chess Colours 

Snippet info

Language

Raku

Visibility

public

Author

fernando-correa

Created

2024-08-05T01:20:11.620389Z

Updated

2024-08-05T01:29:34.514532Z

use Test;

subset ChessPos of Str where /^<[a..h]><[1..8]>$/;

my %a is Set = <a c e g>;
sub chess(ChessPos $p) {
    my ($col, $row) = $p.comb;
    %a{$col}.&{ $row %% 2 ?? .so !! .not }
}

is "d3".&chess, True;
is "g5".&chess, False;
is "e6".&chess, True;
INFO