           (rw/assoc-current-state :normal))
       (= (count directions) 1)
         (-> state
-          (close-door (first directions))
+            (close-door (first directions))
           (rw/assoc-current-state :normal))
       :else
         (rw/assoc-current-state state :close))))
 
-(defn action-select
+(defn directions-to-actions
   [state]
   (let [pickup-directions (pickup-directions state)
         _ (log/info "pickup directions" (vec pickup-directions))

                    (conj actions {:state-id :close
                                   :name "Close"})
                    actions))
        directions {:pickup-directions  pickup-directions
                    :harvest-directions harvest-directions
                    :open-directions    open-directions
                    :close-directions   close-directions}]
      (log/info "num pickup-directions" (count pickup-directions)
                "num harvest-directions" (count harvest-directions)
                "num open-directions" (count open-directions)
                "num close-directions" (count close-directions))
    (cond
      (every? (comp zero? count second) directions)
        (-> state
          (rc/append-log "No available actions.")
          (rw/assoc-current-state :normal))
      (every? (comp zero? count second) (dissoc directions :pickup-directions))
        (smart-pickup state)
      (every? (comp zero? count second) (dissoc directions :harvest-directions))
        (smart-harvest state)
      (every? (comp zero? count second) (dissoc directions :open-directions))
        (smart-open state)
      (every? (comp zero? count second) (dissoc directions :close-directions))
        (smart-close state)
      :else
        (-> state
          (assoc-in [:world :action-select]
                    (map (fn [action hotkey]
                           (assoc action :hotkey hotkey))
                         actions
                         rc/hotkeys))
          (rw/assoc-current-state :action-select)))))

(defn do-selected-action
  [state keyin]
  (if-let [action (get (first (filter (fn [{:keys [state-id hotkey]}]
                                   (= hotkey keyin))
                                 (get-in state [:world :action-select])))
                       :state-id)]
    (case action
      :pickup
        (smart-pickup state)
      :harvest
        (smart-harvest state)
      :open
        (smart-open state)
      :close
        (smart-close state))
    state))

(defn quaff-only-adjacent-cell

                                                                                                     "an"
                                                                                                     "a")
                                                                                                  (get % :name)))
                                                                              harvest-items))))
        (rw/assoc-current-state :normal)))))

(defn harvest-left [state]
  (harvest state :left))
