This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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