   [state & more]
   state)
 
+(defn delete-save-game []
+  ;; delete the save game on player death
+  (doseq [file (filter (fn [file] (re-matches #".*edn" (.getName file))) (file-seq (io/file "save")))]
+    (log/info "Deleting" file)
+    (.delete file)))
+  
 (defn translate-directions
   [keyin]
   (case keyin

      (rc/append-log state "Pick a valid recipe." :white))))


(defn scroll-log
  [state]
  (let [t (get-in state [:world :time])]
    (log/info "scroll-log t" t)
    (log/info "scroll-log logs-viewed" (get-in state [:world :logs-viewed]))
    (-> state
      (update-in [:world :logs-viewed] inc)
      (as-> state
        (let [c (count (filter #(= t (get % :time)) (get-in state [:world :log])))
              logs-viewed (get-in state [:world :logs-viewed])]
          (if (>= logs-viewed c)
            (rw/assoc-current-state state :normal)
            state))))))

(defn init-log-scrolling
  [state]
  (-> state
    (update-in [:world :log]
      (fn [logs]
        (log/info "updating :world :log. logs" logs)
        (mapcat
          (fn [logs-with-same-time]
            (vec
              (reduce (fn [logs-with-same-time log]
                        (log/debug "updating logs-with-same-time" logs-with-same-time)
                        (log/debug "log" log)
                        (let [last-log (last logs-with-same-time)]
                          (if (and (< (+ (count (get last-log :text))
                                      (count (get log :text)))
                                    70)
                                (= (get last-log :color)
                                   (get log :color)))
                            ;; conj short lines
                            (vec (conj (vec (butlast logs-with-same-time))
                                        {:time (get log :time)
                                         :text (clojure.string/join " " [(get last-log :text)
                                                                         (get log :text)])
                                         :color (get log :color)}))
                            ;; pass long lines through
                            (vec (conj logs-with-same-time log)))))
                      []
                      logs-with-same-time)))
          (vals (group-by :time logs)))))
    (as-> state
      (let [t    (get-in state [:world :time])
            logs (filter #(= t (get % :time)) (get-in state [:world :log]))
            logs-viewed (get-in state [:world :logs-viewed] 1)]
        (log/info "logs" logs)
        (as-> state state
          (assoc-in state [:world :logs-viewed] 1)
          (if (and (> (count logs) 1)
                   (= logs-viewed 1))
            (rw/assoc-current-state state :more-log)
            state))))))

(defn get-hungrier-and-thirstier
  "Increase player's hunger."

                          (cond
                            (= current-state :normal)
                              (assoc-in state [:world  :command-seq] [keyin])
                            :else
                              (rc/conj-in state [:world :command-seq] keyin))
                          (assoc-in state [:world :command-seq] command-seq))
