Skip to content

Instantly share code, notes, and snippets.

@deque-blog
Created March 26, 2017 12:17
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
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