 (defn decide-winner [board]
   (cond (three-in-row :x board) (assoc board :winner :x)
         (three-in-row :o board) (assoc board :winner :o)
-        :else (assoc board :winner :none)))
+        :else (assoc board :winner nil)))
 
 (defn handle-win [scene]
   (let [[id board] (->name scene "state")
-        board (decide-winner board)
-        winner (:winner board)]
+        board     (decide-winner board)
+        winner     (:winner board)]
     (if (or (= :x winner) (= :o winner))
       (-> scene
+          (assoc-in [:scene-graph id] board)
           (color-board winner)
-          (assoc-in [:scene-graph id] (assoc board :winner :done)))
+          (assoc-in [:scene-graph id :winner] :done))
       scene)))
 
 (defmiddleware game-logic [scene inputs]

                   (>= x 0) (>= z 0) (< x 3) (< z 3))
                (take-turn id scene pos)
                scene)]
    (handle-win scene)))

(def update-fn (lay debug reload game-logic))

(defn color-board [scene winner]
  (let [new-color   (cond (= :x winner) (c3 1 0 0)
                          (= :o winner) (c3 0 0 1))
        [lid light] (->name scene "light")]
    (assoc-in scene [:scene-graph lid :groundColor] new-color)))

(defn three-in-row [key
               {tl [0 0] t  [1 0] tr [2 0]
