diff options
author | Matt Strapp <strap012@umn.edu> | 2021-04-26 17:13:53 -0500 |
---|---|---|
committer | Matt Strapp <strap012@umn.edu> | 2021-04-26 17:13:53 -0500 |
commit | 13dff37b307094cdc3ad494e7f05ea37d7a52910 (patch) | |
tree | fcf6f65414da69932db9d118925d64092cb6cbef /python/alphaBeta.py | |
parent | Revert "Refactor jsut about everything" (diff) | |
download | csci4511w-13dff37b307094cdc3ad494e7f05ea37d7a52910.tar csci4511w-13dff37b307094cdc3ad494e7f05ea37d7a52910.tar.gz csci4511w-13dff37b307094cdc3ad494e7f05ea37d7a52910.tar.bz2 csci4511w-13dff37b307094cdc3ad494e7f05ea37d7a52910.tar.lz csci4511w-13dff37b307094cdc3ad494e7f05ea37d7a52910.tar.xz csci4511w-13dff37b307094cdc3ad494e7f05ea37d7a52910.tar.zst csci4511w-13dff37b307094cdc3ad494e7f05ea37d7a52910.zip |
Delete useless AB code
Diffstat (limited to 'python/alphaBeta.py')
-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: |