 (def dir-delta {:up [0 1] :down [0 -1]
                 :left [-1 0] :right [1 0]})
 
+(defn move-direction [board direction]
+  (let [[x y] (coords board 0)
+        [dx dy] (dir-delta direction)
+        coords [(+ x dx) (+ y dy)]]
+    (if (bounded-coords? coords)
+      (location board coords)
+      0)))
+
 (defn adjacent-coords [board [x y]]
   (let [adj-loc (map (fn [[dx dy]] [(+ x dx) (+ y dy)])
                      (vals dir-delta))]

(ns tile-game.core
  (:require (clojure.contrib seq math))
  (:import (javax.swing JFrame JPanel )
           (java.awt Color Graphics Graphics2D Dimension Font)))

(def dim 3)
(def scale 150)

(def colors [Color/RED Color/ORANGE Color/YELLOW Color/GREEN

       (adjacent-coords board (coords board piece))))

(defn adjacent? [board p1 p2]
  (= 1 (distance (coords board p1) (coords board p2))))

(defn can-move? [board piece]
  (adjacent? board 0 piece))
