Skip to content

Instantly share code, notes, and snippets.

@uncompiled
Last active March 3, 2018 22:16
Show Gist options
  • Save uncompiled/afe435958f569561f26d487ee38f067a to your computer and use it in GitHub Desktop.
Save uncompiled/afe435958f569561f26d487ee38f067a to your computer and use it in GitHub Desktop.
Replace for loops with map
return board.map((row, x) =>
row.map((_, y) => {
let n = getCellNeighborCount(x, y)
return (isAlive(x, y) ? n > 1 && n < 4 : n === 3) ? 1 : 0
})
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment