Marching squares: Difference between revisions

m
→‎{{header|Raku}}: small simplifications
m (→‎{{header|Raku}}: insignificant changes)
m (→‎{{header|Raku}}: small simplifications)
Line 338:
 
for ^width X ^height -> (\x,\y) {
unlessif data[y;x] == 0 {
my ($cx,$cy,$directions,$previous) = x, y;
repeat {
my $mask = 0;
for (0,0,1),(1,0,2),(0,1,4),(1,1,8) -> (\dx,\dy,\b) {
my ($mx,$my) = $cx+dx,$cy+dy;
$mask += b if so all $mx>1, $my>1, data[$my-1;$mx-1] != 0
}
given do given $mask {
Line 355:
} {
$directions ~= $previous = $_ ;
($cx,$cy) <<+=<< |(@dx[.value], @dy[.value])
}
} until $cx==x and $cy==y ;
2,392

edits