Skip to content

Instantly share code, notes, and snippets.

@trikitrok
Last active August 29, 2015 14:10
Show Gist options
  • Save trikitrok/148cebd10cc1de39d419 to your computer and use it in GitHub Desktop.
Save trikitrok/148cebd10cc1de39d419 to your computer and use it in GitHub Desktop.
;...
(facts
"about game of life rules"
(fact
"a location with a cell will have a cell in next generation
if it has the right number of neighbors"
(will-have-cell? [1 2] [[1 2] [1 1] [1 3]]) => true
(will-have-cell? [1 2] [[1 2] [1 1]]) => false
(will-have-cell? [1 2] [[1 2] [1 1] [1 3] [2 2]]) => true
(will-have-cell? [1 2] [[1 2] [0 2] [1 1] [1 3] [2 2]]) => false)
(fact
"a location without a cell will have a cell in next generation
if it has the right number of neighbors"
(will-have-cell? [1 2] [[1 1] [1 3]]) => false
(will-have-cell? [1 2] [[1 1] [1 3] [2 2]]) => true
(will-have-cell? [1 2] [[1 1]]) => false))
;...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment