   (let [[f r] (vec p)]
     [(- 8 (parse-int r)) (file->i f)]))
 
-(declare valid-piece?)
-
 (defn in
   "Get the contents of a square on the board. Nil if empty"
   [board sq]
-  (let [p (get-in board (to-board-ks sq))]
-    (if (valid-piece? p) p)))
+  (get-in board (to-board-ks sq)))
 
 (defn put
   "Puts a piece at a square in the board"

(ns chess.core
  (:require [om.core :as om :include-macros true]
            [om.dom :as dom :include-macros true]
            [clojure.string :refer [upper-case]]))

(def initial-board
  [[:r :n :b :q :k :b :n :r]
   [:p :p :p :p :p :p :p :p]
   [:. :. :. :. :. :. :. :.]
   [:. :. :. :. :. :. :. :.]
   [:. :. :. :. :. :. :. :.]
   [:. :. :. :. :. :. :. :.]
   [:P :P :P :P :P :P :P :P]
   [:R :N :B :Q :K :B :N :R]])

(def empty-sq :.)

(def pieces {:r "rook" :R "rook"
             :n "knight" :N "knight"

        om/IRender
        (render [_]
          (apply dom/div #js {:className "board"}
                   (map-indexed
                    (fn [i r] (apply dom/div #js {:className "row" :id (- 8 i)}
                                   (map-indexed (fn [j s] (dom/div #js {:className "square" :id (str (i->file j) (- 8 i))}
                                                         (if s
                                                           (dom/div #js {:className (str "piece " (colour s) " " (pieces s))} nil)))) r)))
                    (:board app))))))
    app-state
