aboutsummaryrefslogtreecommitdiff
path: root/challenge-281/0rir/raku/Chess.rakumod
blob: 85809b7d62fc791e808d511696e840cbd8fac56b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
unit class Chess;

=begin comment
    Chess -- Miscellany supporting definitions of-- and  actions on-- a
            chess board.
=end comment

constant @square   is export = [ 063];         # a chessboard

our @file-name     is export = [ 'a''h'];      
our @rank-name     is export = [ 18];
our @algebraic     is export = ( @file-name X[~]  @rank-name).sort( {.flip});
our %algebraic2sq  is export =   @algebraic Z[=>] @square;
sub algebraic2sq( Str $a --> Int) is export { %algebraic2sq{$a} }