   [(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

(def cell-size 32)
(def aspectRatio (float (/ 4 3)))
(def time-limit 10)

(defn abs
  [number]


(defn move-player
  [state direction]
  (when (= :playing (:game-state @state))
    (swap! state
           (fn [current]
             (let [{:keys [player inventory item-locations]} current
                   [player-x player-y] player
                   new-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))
                   item-at-player (get item-locations new-player)
                   new-inventory (if item-at-player
                                   (conj inventory item-at-player)
                                   inventory)
                   new-item-locations (if item-at-player
                                        (dissoc item-locations new-player)
                                        item-locations)]
               (assoc current
                      :player new-player
                      :inventory new-inventory
                      :item-locations new-item-locations))))))

(defn timeup?
  [start-time]
