     ))
 
 (def id->tile-class
-  {0 nil
-   1 "ground"
-   2 "bridge"
-   3 "fence"
-   4 "lava"
-   5 "water"
-   6 "spikes"
-   7 "start"
-   8 "exit"})
+  {"0" nil
+   "1" "ground"
+   "2" "lava"
+   "3" "spikes"
+   "4" "exit"})
 
 (defn editable-input [ctx owner]
   (reify

  (.log js/console (clj->js obj)))

(def grid-content [
           [[0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0]]
           [[0] [0] [0] [0] [1] [0] [0] [0] [0] [0] [0] [0] [1] [0] [0] [0] [0] [0] [0] [0]]
           [[0] [0] [0] [0] [1] [1] [1] [1] [1] [0] [1] [1] [1] [0] [0] [0] [0] [0] [0] [0]]
           [[0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0]]
           [[0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0]]
           [[0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0]]
           [[0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0]]
           [[0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0]]
           [[9] [1] [4] [4] [4] [4] [4] [4] [4] [4] [5] [5] [5] [5] [5] [5] [5] [5] [1] [0]]
           [[1] [1] [1] [1] [1] [1] [1] [1] [1] [1] [1] [1] [1] [1] [1] [1] [1] [1] [1] [1]]
           ])

(defn indices [pred coll]
  (keep-indexed #(when (pred %2) %1) coll))

(defn contains-hero [row]
  (some #{9} row)
  )

(defn is-hero [cell]
  (= cell [9]))

(defn hero-start-position [grid-content]
  (let [row-index (first (indices contains-hero (reverse grid-content)))
        row (get (vec (reverse grid-content)) row-index)
        col (first (indices is-hero row))]
    (println row)
    (println col)
    {:bottom (* row-index 70) :left (* col 70)}
    )
  )

(defn hero-classes [app]
  (let [
        left-class (when (> 0 (get-in app [:hero :dx]))
                     "left "
                     )]
    (if (moving? (app :hero))
      (str "hero " left-class "step-" (step-class app))
      (str "hero " left-class)
      )
    ))

(defn move-left [hero]
  (let [left-position (get-in hero [:position :left])]
    (if (moving? hero)
      (if (> 0 left-position)
        (update-in hero [:position :left] (fn [_] 0))
        (update-in hero [:position :left] (fn [old-left] (+ old-left (hero :dx)))))
      hero
      )
    ))

(defn move-right [hero]
  (let [left-position (get-in hero [:position :left])]
    (if (moving? hero)
      (if (> left-position 1340)
        (update-in hero [:position :left] (fn [_] 1340))
        (update-in hero [:position :left] (fn [old-left] (+ old-left (hero :dx)))))
      hero
      )
    ))

(defn lava-damage [hero]
  hero)
