    :pre [(my-is-a? :position position)] }
 
   (let [enemy-position (flip-position position)]
-    (set (filter (partial unoccupied? enemy-position)
-            (map second (locations-under-attack-moves enemy-position))))
-  ))
+   (when debug (println "enemy-position" enemy-position))
+    (set (map second (moves enemy-position)))))
+        ;; (filter (partial unoccupied? enemy-position)
+                ;; (map second (locations-under-attack-moves enemy-position))))
 
 
 

;;;;;;;;;;;;;; TESTS ;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defn string->position-and-print[x y]
   (let [position (string->position x y)]
     (println (position->string position))
     position))
;; (test-king-cannot-move-to-a-location-under-attack)
;; (locations-under-attack (string->position-and-print "bbn\n\nK" :white))
(defn test-king-cannot-move-to-a-location-under-attack[]
      (is (= []
         (moves (string->position-and-print "bbn\n\nK" :white)))))

(defn test-king-moves[]
  (is (= '([[0 0] [1 1]] [[0 0] [1 0]] [[0 0] [0 1]])
         (moves (string->position "k" :black)))
      )
  (is (= '([[0 0] [1 1]] [[0 0] [0 1]])
         (moves (string->position "kN" :black))))
  )
(defn test-non-ranging-moves[]

                "K"
                "k")]
    (some #(if (= piece (second %))
             (first %))
          (:piece-locations position))
    ))
;; (:king-moves (string->position-and-print "K" :white)
;;         (king-moves (string->position-and-print "K" :white))
;;
(defn king-moves[position]
  (when debug
  (println "king-moves")
  (println position))

  (remove (fn[move]
           (when debug (println "move in fn is" move)
            (println "second move" (second move))
            (println (:locations-under-attack position)))
            (contains? (:locations-under-attack position)
                               (second move)))
          (non-ranging-moves position (king-location position)
                             king-rules) 
          ))

(defn update-checkmated[position]
  (assoc position :checkmated
           (and (:in-check position)
                (= 0 (count (:king-moves position))))))

(defn update-in-check[position]
  (assoc position :in-check
           (contains? (:locations-under-attack position)
                      (king-location position))
  ))
  

(defn update-under-attack[position]
    (assoc position :locations-under-attack
           (locations-under-attack position)))

(defn update-king-moves[position]
        (assoc position :king-moves (king-moves position)))
(defn update-moves[position]
   (assoc position :moves (moves position))
  )
(defn update-algebraic-moves[position]
   (assoc position :algebraic-moves 
       (map (partial move->algebraic-notation position)
          (:moves position))))
(pprint starting-position)
(defn update-position[position]
  (-> position update-under-attack
      update-king-moves
      update-in-check
      update-checkmated
      update-moves
      update-algebraic-moves))

;; (string->position "rK" :white)
(defn string->position[string color]
  {:post  [(is-position? %)]
   :pre [(string? string)
