Skip to content

Commit

Permalink
killer is chased by *closest* police officer
Browse files Browse the repository at this point in the history
  • Loading branch information
alexpalade committed Apr 19, 2020
1 parent 7319896 commit 717fc1b
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/killer.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,13 @@

(defmethod lose-disguise ((game sil-game) (killer killer))
(when (disguised killer)
(let ((all-police (get-all-persons-of-type game 'police))
(chaser nil))
(setf all-police (remove-if (lambda (x) (state-p x 'chasing)) all-police))
(when all-police
(setf chaser (random-nth all-police))
(let ((chaser (get-closest-police game (row killer) (col killer))))
(when chaser
(setf (target chaser) killer)
(setf (state chaser) 'chasing)
(setf (rest-time chaser) 0)
(setf (destination chaser) (list (row killer) (col killer)))
(update-path-person game chaser))))

(setf (disguised killer) nil))

(defmethod time-since-last-kill ((this killer))
Expand Down

0 comments on commit 717fc1b

Please sign in to comment.