   [(pixels->cell (/ game-width 2))
    (- (pixels->cell game-height) 1)])
 
+(defn random-location
+  []
+  (map (comp int rand) [(inc game-x-cells) game-y-cells]))
+
+(defn random-item-spawns
+  [item number]
+  (into {}
+        (map #(vector % item) (take number (repeatedly random-location)))))
+
+(defn random-spawns
+  []
+  (merge (random-item-spawns :flask 5)
+         (random-item-spawns :bones 30)))
+
 (defn initial-state
   []
   {:start-time (js/Date.)
-   :state :playing
+   :game-state :playing
+   :item-locations (random-spawns)
+   :inventory []
    :player start-position} )
 
 (def keycode->key


(defn move-player
  [state direction]
  (swap! state
         (fn [current]
           (let [{:keys [player]} current
                 [player-x player-y] player]
             (assoc current
                    :player (boundary
                              (condp = direction
                                :left [(dec player-x) player-y]
                                :right [(inc player-x) player-y]
                                :forward [player-x (dec player-y)]
                                :back [player-x (inc player-y)]
                                player)))))))

(defn timeup?
  [start-time]

(def cell-size 32)
(def aspectRatio (float (/ 4 3)))
(def time-limit 10)
(def number-bones-needed 10)
(def win-message "You won and can build a dragon")
(def lose-message "You lost! The villagers will kill you now :(")

(defn abs
  [number]
