Skip to content

Instantly share code, notes, and snippets.

@BeauNouvelle
Created August 6, 2018 07:01
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 BeauNouvelle/338a06201d7afa5cfaa7be09675b5015 to your computer and use it in GitHub Desktop.
Save BeauNouvelle/338a06201d7afa5cfaa7be09675b5015 to your computer and use it in GitHub Desktop.
switch livingNeighbors.count {
case 2...3 where cell.state == .alive:
updatedCells.append(cell)
case 3 where cell.state == .dead:
let liveCell = Cell(x: cell.x, y: cell.y, state: .alive)
updatedCells.append(liveCell)
default:
let deadCell = Cell(x: cell.x, y: cell.y, state: .dead)
updatedCells.append(deadCell)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment