                     :create create
                     }))
     (.start (.-state game) "main"))
-(set! (.-restartGame *game*) start)
 
 (defprotocol Functor
   (restart [this]))

                 "\nwhite-piece: " (result-count rcore/*white-piece*))))))

(defn create-pieces [piece-name game]
  (let [piece-color (grid-name->rcore-grid piece-name)]
    (dotimes [y 8]
      (dotimes [x 8]
        (let [phaser-border (.-phaserBorder game)
              phaser-pos
              (grid-pos->phaser-pos [x y])

                (assoc-in phaser-border [y x piece-name] piece)))))))

(defn create-possible-grids [grid-name game]
  (let [border (.-border game)
        height(rcore/border-height border)
        width (rcore/border-width border)]
    (dotimes [y height]
      (dotimes [x width]
        (let [phaser-border (.-phaserBorder game)
              pgrid
              (.sprite (.-add game) (+ 5 (* x 75)) (+ 5 (* y 75)) grid-name)]
          (set! (.-inputEnabled pgrid) true)
          (.add (.-onInputDown (.-events pgrid)) on-click-possible-grid game)
          (set! (.-visible pgrid) false)
          (set! (.-gridPosition pgrid) [x y])
          (set! (.-gridColor pgrid) rcore/*possible-grid*)
          (set! (.-useHandCursor (.-input pgrid)) true)
          (set! (.-phaserBorder game)
                (assoc-in phaser-border [y x grid-name] pgrid)))))))

(defn init-border [game]
  (let [phaser-border (.-phaserBorder game)
