 
 (defn end-points [character]
   (let [{:keys [x y]} character
-        _width  (inc width)
-        _height (inc height)
+        _width  (inc window-width)
+        _height (inc window-height)
         zw (range 0 _width)
         zh (range 0 _height)
         ziy (range 0 y)
         zix (range 0 x)
-        ++yh (range (inc y) height)
-        ++xw (range (inc x) width)
+        ++yh (range (inc y) window-height)
+        ++xw (range (inc x) window-width)
         opposite-wall (vec (case (:direction character)
            "n" (map #(vec [% 0])      zw)
-           "s" (map #(vec [% height]) zw)
+           "s" (map #(vec [% window-height]) zw)
            "w" (map #(vec [0 %])      zh)
-           "e" (map #(vec [width %])  zh)))
+           "e" (map #(vec [window-width %])  zh)))
         adjenct-wall (vec (case (:direction character)
            "n" (map #(vec [0 %])      ziy)
            "s" (map #(vec [0 %])      ++yh)
            "w" (map #(vec [% 0])      zix)
            "e" (map #(vec [% 0])      ++xw)))
         adjenct-wall2 (vec (case (:direction character)
-           "n" (map #(vec [width %])  ziy)
-           "s" (map #(vec [width %])  ++yh)
-           "w" (map #(vec [% height]) zix)
-           "e" (map #(vec [% height]) ++xw)))]
+           "n" (map #(vec [window-width %])  ziy)
+           "s" (map #(vec [window-width %])  ++yh)
+           "w" (map #(vec [% window-height]) zix)
+           "e" (map #(vec [% window-height]) ++xw)))]
     (concat opposite-wall adjenct-wall adjenct-wall2)
     ))
 


(defn shorten-line [level line]
  (def shortened-line (take-while #(let [[x y] %
                     x (min (dec width)  (max 0 x))
                     y (min (dec height) (max 0 y))
                     current-block (get-in level [x y])]
                                     (not (current-block :solid))
                                     ) line))

  (let [
        buffer ((.. terminal -ScreenBufferHD -create)
                #js {:dst    term
                     :width  window-width
                     :height window-height
                     })
        get-in-level (partial get-in level)]

