I’m on the “Molotov Medic” level and I’m getting this error:
Missing `this.` keyword; should be `this.cond`.
There is no function `cond`, but `this` has a method `cond`.
For the following code on line 7:
(defn maxHealth? [friend]
(= (.maxHealth friend)
(.health friend)))
(defn getFriendWithLeastHealth []
(let [friends (filter #(not (maxHealth? %1)) (.getFriends this))]
(cond
(= 1 (count friends)) (first friends)
(< 1 (count friends)) (reduce #(if (<= (.health %1) (.health %2)) %1 %2) friends))))
(defn heal [friend]
(.attack this friend)
(.say (str "Healing " friend)))
(defn attackNearestEnemy []
(let [enemy (.getNearestEnemy this)]
(if (some? enemy)
(do (.attack this enemy)
(.say this (str "Attacking " enemy))))))
(let [friend (getFriendWithLeastHealth)]
(if (and (some? friend) (maxHealth? friend))
(heal friend)
(attackNearestEnemy)))
Is “cond” not implemented? This is my first time using Clojure, so it could very well be my code.