Code for ghost 0:
(if (> (/ NUM_SQUARES
(- (squares-to-pacman West)
(- 366.091
(cosine CONSECUTIVE_MOVES_FORWARD))))
(_ (_ (squares-to-non-dot Forward))))
Forward
(if (not (not (> 366.091
(squares-to-pacman (if (<= (/ (% (squares-to-non-dot Forward)
(squares-to-non-dot (if (<= (/ (% (+ (ghosts-in-dir Left)
(% (+ (ghosts-in-dir Left)
366.091)
(squares-to-non-dot Right)))
(squares-to-non-dot Right))
(squares-to-non-dot Left))
(+ (ghosts-in-dir Left)
366.091))
Forward
Forward)))
366.091)
(+ (ghosts-in-dir Left)
366.091))
Forward
Left)))))
Forward
(if (not (not (> (/ (% (+ (squares-to-non-dot Forward)
(squares-to-non-dot Forward))
(ghosts-in-dir Right))
(ghosts-in-dir Right))
(squares-to-pacman Forward))))
Forward
(if (> 366.091
366.091)
Right
(if (not (> (/ (+ (ghosts-in-dir Left)
366.091)
(ghosts-in-dir Right))
(squares-to-pacman Forward)))
Left
Left)))))
Prefix notation for ghost 0
Code for ghost 1
(if (and (and (<= (ghosts-in-dir Forward)
(squares-to-wall Forward))
(<= (squares-to-wall (drop-pheromone (_ (squares-to-wall Right))
(_ (* (pacmen-in-dir (if (<= (ghosts-in-dir Left)
(pacmen-in-dir (drop-pheromone (squares-to-wall (drop-pheromone NUM_SQUARES
(pacmen-in-dir Right)
Forward))
(_ (_ (/ (* (pacmen-in-dir Right)
PHEROMONE-VAL)
(* (pacmen-in-dir Forward)
(ghosts-in-dir Forward)))))
(drop-pheromone (squares-to-wall (drop-pheromone 92
264.004
East))
(* (pacmen-in-dir (drop-pheromone 92
(/ (ghosts-in-dir Forward)
(/ 135.39
(ghosts-in-dir Forward)))
(drop-pheromone (squares-to-wall East)
1.776
(if (and (and (<= (squares-to-wall South)
NUM_SQUARES)
(> (squares-to-pacman Forward)
(round (squares-to-wall Forward))))
(<= (squares-to-wall Forward)
(* (* (pacmen-in-dir Forward)
(ghosts-in-dir Forward))
(squares-to-pacman South))))
Right
Forward))))
(ghosts-in-dir Forward))
Forward))))
Forward
Forward))
92))
Forward))
PHEROMONE-VAL))
(<= (squares-to-wall Forward)
(* (* 92
PHEROMONE-VAL)
264.004)))
Right
Forward)
Prefix notation for ghost 1
Code for ghost 2
(if (or (not (or (>= (ghosts-in-dir West)
(pacmen-in-dir East))
(>= (squares-to-non-dot West)
(squares-to-non-dot West))))
(not (< PHEROMONE-STRENGTH
(pacmen-in-dir West))))
(if (and (>= (ghosts-in-dir (if (and (or (or (not (and (or (not (>= (ghosts-in-dir (if (and (or (< (round (round (- (sine (squares-to-pacman East))
(pacmen-in-dir East))))
(pacmen-in-dir Backwards))
(>= (ghosts-in-dir North)
(pacmen-in-dir Right)))
(< (squares-to-non-dot Left)
(squares-to-non-dot North)))
North
West))
(pacmen-in-dir Right)))
(or (>= (ghosts-in-dir North)
(pacmen-in-dir Right))
(not (>= (squares-to-non-dot West)
(pacmen-in-dir Right)))))
(< PHEROMONE-VAL
(squares-to-non-dot West))))
(< PHEROMONE-STRENGTH
(pacmen-in-dir Right)))
(< (abs (* PHEROMONE-STRENGTH
(pacmen-in-dir West)))
(squares-to-non-dot North)))
(not (or (>= (ghosts-in-dir East)
(pacmen-in-dir East))
(>= (dots-in-dir East)
(squares-to-non-dot West)))))
North
Right))
(pacmen-in-dir East))
(< (abs (* (- (round (squares-to-non-dot Right))
(pacmen-in-dir East))
(pacmen-in-dir West)))
(squares-to-non-dot North)))
North
Right)
West)
Prefix notation for ghost 2
Code for ghost 3
(drop-pheromone (ghosts-in-dir West)
(pacmen-in-dir (drop-pheromone PHEROMONE-VAL
(round (- (% (squares-to-wall (drop-pheromone (squares-to-ghost Backwards)
(squares-to-ghost Forward)
Backwards))
(- (squares-to-non-dot Left)
(squares-to-ghost Backwards)))
(squares-to-wall West)))
Backwards))
East)
Prefix notation for ghost 3