Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
(defn minimax
"Implements the minimax recursion:
* Call the leaf node evaluation if the depth is zero
* Otherwise goes one level deeper"
[ai turn depth]
(if (or (zero? depth) (turn/game-over? turn))
(eval-turn ai turn)
(minimax-step ai turn
(fn [_ transition]
(minimax ai
(turn/next-turn turn transition)
(dec depth))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment