 
 (require '[clojure.string :as string])
 
-;;unitType 0 (Reaper), 1 (Destroyer), 3 (Tanker), 4 (Wreck)
-(def unit-types [:reaper :destroyer :placeholder :tanker :wreck])
+;;unitType 0 (Reaper), 1 (Destroyer), 2 (Doof), 3 (Tanker), 4 (Wreck)
+(def unit-types [:reaper :destroyer :doof :tanker :wreck])
 
 (defrecord Unit
   [unit-id unit-type player-id mass radius x y vx vy extra extra2])

                               (println "enemy reapers: " (string/join " " (map #(into {} %) enemy-reapers)))
                               (println "enemy destroyers: " (string/join " " (map #(into {} %) enemy-destroyers)))
                               (println "my reaper : " (string/join " " my-reaper))
                               (println "my-destroyer : " (string/join " " my-destroyer))
                               (println "next-wreck : " (string/join " " next-wreck))
                               (println "next-tanker : " (string/join " " next-tanker)))
        (println (compute-reaper-action my-reaper next-wreck))
        (println (compute-destroyer-action my-destroyer next-tanker))
        (println "WAIT")))))

      ; (binding [*out* *err*]
      ;   (println "Debug messages..."))

    (near my-reaper next-wreck) (str (:x next-wreck) " " (:y next-wreck) " 150")
    true (str (:x next-wreck) " " (:y next-wreck) " 300")))

(defn compute-destroyer-action [my-destroyer next-tanker my-rage tankers]
  (cond
    (nil? next-tanker) "WAIT"
    (in my-destroyer next-tanker) (str (:x next-tanker) " " (:y next-tanker) " 0")
    (and (or (in my-destroyer next-tanker) (near my-destroyer next-tanker)) (> my-rage 200)) (str "SKILL " (:x (last tankers)) " " (:y (last tankers)))
    (> my-rage 150) (str "SKILL " (:x next-tanker) " " (:y next-tanker))
    true (str (:x next-tanker) " " (:y next-tanker) " 300")))

(defn compute-doof-action [my-doof enemy-reapers my-rage]
  (let [nearest-enemy-reaper (first (sort-by #(distance (:x my-doof) (:y my-doof) (:x %) (:y %)) enemy-reapers))]
    (cond
      (>= my-rage 300) "WAIT"
      true (str (:x nearest-enemy-reaper) " " (:y nearest-enemy-reaper) " 300"))))

(defn -main [& args]
  (while true
