Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
(defn minimax-step
"One stage of the minimax algorithm:
* Apply the maximizing or mininizing step to all transitions of the turn
* Evaluate the lower level using the on-transition function"
[ai turn open-recur
& {:keys [max-fn min-fn]
:or {max-fn max, min-fn min}}]
(apply
(if (maximizing? ai turn) max-fn min-fn)
(map
(fn [[coord transition]] (open-recur coord transition))
(turn/transitions turn))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment