On Mar 3, 2009, at 11:01 PM, Timothy Pratley wrote:
Just because there is always another way :P (defn determine-new-state [x y] (let [alive (count (for [dx [-1 0 1] dy [-1 0 1] :when (cells [(+ x dx) (+ y dy)])] :alive))] (if (cells [x y]) (< 2 alive 5) (= alive 3))))
Nice! And for more golfing fun: (defn calc-state [] (dosync (ref-set cells (reduce conj {} (for [x (range 32) y (range 48)] [[x y] (determine-new-state x y)]))))) --Steve
smime.p7s
Description: S/MIME cryptographic signature