RCRPG/Raku: Difference between revisions

Content added Content deleted
m (→‎{{header|Perl 6}}: a few minor tweaks and bug fixs)
m (→‎{{header|Perl 6}}: GLR updates, edited works with)
Line 23: Line 23:
As with the [[RCRPG/Perl|Perl version]].
As with the [[RCRPG/Perl|Perl version]].
==Code==
==Code==
{{works with|niecza|v24}}
{{works with|Rakudo|2015.09}}
{{works with|Rakudo|2013.05}}
<lang perl6>my %commands;
<lang perl6>my %commands;
my %rooms;
my %rooms;
Line 41: Line 40:
up => 'in the ceiling',
up => 'in the ceiling',
down => 'in the floor',
down => 'in the floor',
map { ($_ => "to the $_") }, <north south east west>;
(map { ($_ => "to the $_") }, <north south east west>).Slip;


my %dir_vec =
my %dir_vec =
Line 51: Line 50:
west => [-1, 0, 0];
west => [-1, 0, 0];


my %dir_rev = map { ($^a => $^b), $^b => $^a },
my %dir_rev = map { ($^a => $^b, $^b => $^a).Slip },
< north south east west up down >;
< north south east west up down >;


Line 117: Line 116:
}
}


for <north south east west up down> -> $dir {
for flat <north south east west up down> -> $dir {
command [$dir, substr($dir,0,1)], '', 0, { move($dir) };
command [$dir, substr($dir,0,1)], '', 0, { move($dir) };
}
}