Skip to content

Instantly share code, notes, and snippets.

Created May 14, 2016 18:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/5eb500b89fd6bcad63d35fdaeccd5d8d to your computer and use it in GitHub Desktop.
Save anonymous/5eb500b89fd6bcad63d35fdaeccd5d8d to your computer and use it in GitHub Desktop.
my @spot = [rand xx 10] xx 10;
my @neighbors;
for ^10 X ^10 -> ($i, $j) {
@neighbors[$i][$j] = eager gather for
[-1,-1],[+0,-1],[+1,-1],
[-1,+0], [+1,+0],
[-1,+1],[+0,+1],[+1,+1]
{
take-rw @spot[$i + .[0]][$j + .[1]] // next;
}
}
die "Bogus code" unless @neighbors[1][1][0] === @spot[0][0];
die "Bad decont" unless @neighbors[1][1][0] =:= @spot[0][0];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment