     [clojure.string :refer [join]]
     [jayq.core :refer [$ ajax document-ready]]))
 
-;;------------------------------------------------------------
-;; Connect to the Browser REPL
-;;------------------------------------------------------------
-
-(defn connect-repl []
-  (ajax {:url "repl-url"
-         :cache false
-         :dataType "text"
-         :success #(repl/connect %)}))
-
 (enable-console-print!)
+
+;;------------------------------------------------------------
+;; Pieces.
+;;------------------------------------------------------------
 
 (def pieces
   {:I {:name :I :coords [[0 0] [0 -1] [0 1] [0 2]]}

      (draw-cell ctx x y board))
    nil))

(defn create-drawable-board
  "Creates a new drawable board, by combining the current piece with the current board."
  []

  [piece x y board]
  (every? #(coord-fits? % x y board) (:coords piece)))

;;------------------------------------------------------------
;; PAINTING (for showing the game on a canvas)
;;------------------------------------------------------------

(defn size-canvas
  "Set the size of the canvas."
  []
  (let [canvas (.getElementById js/document "canvas")]
    (aset canvas "width" (* cell-size 10))
    (aset canvas "height" (* cell-size 22))))

(defn get-cell-color
  "Get the color for the given cell value."
  [value]
  (if (zero? value) "#EEE" "#CC0000"))

(defn draw-cell
  "Draw the given cell of the given board."
  [ctx x y board]
  (let [color (get-cell-color (read-board x y board))
        left (* cell-size x)
        top  (* cell-size y)]
    (aset ctx "fillStyle" color)
    (.fillRect ctx left top cell-size cell-size)))

(defn draw-board
  "Draw the given board to the canvas."
