From 13dff37b307094cdc3ad494e7f05ea37d7a52910 Mon Sep 17 00:00:00 2001 From: Matt Strapp Date: Mon, 26 Apr 2021 17:13:53 -0500 Subject: Delete useless AB code --- python/alphaBeta.py | 32 -------------------------------- 1 file changed, 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: -- cgit v1.2.3