         ;;(println cell x y)
         (when (not (nil? cell))
           (let [cell-items (cell :items)
-                out-char (if (not (nil? cell-items))
+                out-char (if (and cell-items (not (empty? cell-items)))
                            (case :ring 
                              :ring           ["="]
                              :food           ["%"]

  
  
(defn update-state [state keyin]
  (println "last-command " (get-last-command state))
  (case (get-last-command state)
    :open (let [state-with-command (set-last-command state nil)]
            (open-door state-with-command (case keyin
                                            \h :left
                                            \j :down
                                            \k :up
                                            \l :right)))
    :close (let [state-with-command (set-last-command state nil)]
             (close-door state-with-command (case keyin
                                              \h :left
                                              \j :down
                                              \k :up
                                              \l :right)))
    :pick-up (let [state-with-command(set-last-command state nil)]
               (pick-up state-with-command keyin))
    (case keyin
      \h (move-left state)
      \j (move-down state)
      \k (move-up state)
      \l (move-right state)
      \i (toggle-inventory state)
      \, (toggle-pick-up state)
      \o (set-last-command state :open)
      \c (set-last-command state :close)
      state)))

(defn render-pick-up [state]
  ;; maybe draw pick up menu

                                                                (%2 :name))
                                            cell-items)
                               (repeat (apply str (repeat 40 " ")))))]
    ;(println "player-x" player-x "player-y" player-y)
    ;(println "cell" cell)
    ;(println "cell-items" cell-items)
    ;(println "type-contents" (type contents))
    ;(println "contents" contents)
    (doall (map-indexed (fn [y line] (do
    ;                                   (println "y" y "line" line "type" (type line))
                                       (s/put-string (state :screen) 40 (inc y) line {:fg :black :bg :white :styles #{:bold}}))) contents))
    (println "header")
    (s/put-string (state :screen) 40 0 "  Pick up                               " {:fg :black :bg :white :styles #{:underline :bold}}))))

(defn render-inventory [state]
  (when (-> state :world :show-inventory?)
    (let [contents (take 22
                     (concat (map #(format "%-40s"  (% :name)) (-> state :world :player :inventory))
                             (repeat (apply str (repeat 40 " ")))))]
      (println "render-inventory")
      (println "contents" contents)
      (dorun (map-indexed (fn [y line] (s/put-string (state :screen) 40 (inc y) line {:fg :black :bg :white :styles #{:bold}})) contents))
      (s/put-string (state :screen) 40 0 "  Inventory                             " {:fg :black :bg :white :styles #{:underline}}))))

(defn render [state]
  (do
