Marching squares: Difference between revisions
m
→{{header|Raku}}: insignificant changes
(added Raku programming solution) |
m (→{{header|Raku}}: insignificant changes) |
||
Line 339:
for ^width X ^height -> (\x,\y) {
unless data[y;x] == 0 {
my
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
}
when * ∈ ( 1, 5, 13 ) { N }
when * ∈ ( 2, 3, 7 ) { E }
Line 354 ⟶ 353:
when * ∈ ( 6 ) { $previous == N ?? W !! E }
when * ∈ ( 9 ) { $previous == E ?? N !! S }
} {
▲ ($cx,$cy) <<+=<< |(@dx[.value], @dy[.value]) }
} until $cx==x and $cy==y ;
return
▲ }
}
}
|