Skip to content

Instantly share code, notes, and snippets.

@tfnico
Created December 3, 2011 19:52
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 tfnico/1427957 to your computer and use it in GitHub Desktop.
Save tfnico/1427957 to your computer and use it in GitHub Desktop.
Started Clojure game-of-life
(ns conways.test.core
(:use [conways.core])
(:use [clojure.test]))
(def world #{})
(defn isALive? [world x y] (get world [x y]) )
(defn setLive [world x y] (conj world [x y]))
(defn willSurvive? [world x y] false)
(defn perm [world] (filter (fn [[x y]] (willSurvive? world x y) ) world))
(deftest emptyWorld
(is (not (isALive? world 0 0)))
)
(deftest oneCellWorld
(is (isALive? (setLive world 0 0) 0 0))
)
(deftest oneCellWorldDisapears
(is (not (isALive? (perm (setLive world 0 0)) 0 0)))
)
(deftest emptyWorld2
(is (= 0 (count world)))
)
@kurthaeusler
Copy link

Cant get enough eh?

@tfnico
Copy link
Author

tfnico commented Dec 3, 2011

Well, this one in particular left me craving for more :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment