diff options
Diffstat (limited to '')
-rw-r--r-- | python/alphaBeta.py | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/python/alphaBeta.py b/python/alphaBeta.py index 8e041fe..fb30391 100644 --- a/python/alphaBeta.py +++ b/python/alphaBeta.py @@ -4,38 +4,6 @@ class GameController(object): # when you get a new move, it is assumed that the game is not ended yet assert state.get_moves() - -def alpha_beta(node, alpha, beta): - - # Based on https://en.wikipedia.org/wiki/Alpha%E2%80%93beta_pruning#Pseudocode - # node needs to support three operations: isTerminal(), value(), getChildren(), maximizingPlayer() - - if node.isTerminal(): - return node.value() - - if node.maximizingPlayer(): - - v = float("-inf") - for child in node.getChildren(): - - v = max(v, alpha_beta(child, alpha, beta)) - alpha = max(alpha, v) - if beta <= alpha: - break - - else: - - v = float("inf") - for child in node.getChildren(): - - v = min(v, alpha_beta(child, alpha, beta)) - beta = min(beta, v) - if beta <= alpha: - break - - return v - - # A class for defining algorithms used (minimax and alpha-beta pruning) class AlphaBeta: |