Skip to content

Instantly share code, notes, and snippets.

@reflash
Created August 28, 2018 06:08
Show Gist options
  • Save reflash/073439e6ad3f9733c839d5976d232ae8 to your computer and use it in GitHub Desktop.
Save reflash/073439e6ad3f9733c839d5976d232ae8 to your computer and use it in GitHub Desktop.
static member NeighboursAt(x : int, y: int, states : int [][]) : int =
[for i in [(x-1)..(x+1)] do
for j in [(y-1)..(y+1)] do
if ((i <> x || j <> y) &&
Utility.InArrayRange i j states.Length)
then yield states.[i].[j];]
|> Utility.FoldBySum
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment