From e840572a2e89f86522dfee7b6943831f03a93abe Mon Sep 17 00:00:00 2001 From: Jack Vehmeier Date: Mon, 26 Apr 2021 21:42:49 -0500 Subject: fixed node again --- python/alphaBeta.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'python') diff --git a/python/alphaBeta.py b/python/alphaBeta.py index b35a7f2..be44c85 100644 --- a/python/alphaBeta.py +++ b/python/alphaBeta.py @@ -12,10 +12,19 @@ class GameController(object): class ABNode(object): # A class for Node related operations def __init__(self, state): self.Current = state - self.CurrentScore = self.Current.score[1]-self.Current.score[2] + if state.player == 1: + self.CurrentScore = self.Current.score[2]-self.Current.score[1] + elif state.player ==2: + self.CurrentScore = self.Current.score[1]-self.Current.score[2] self.children = {} + + def update_score(self): - self.CurrentScore = self.Current.score[1]-self.Current.score[2] + if self.Current.player == 2: + self.CurrentScore = self.Current.score[1]-self.Current.score[2] + elif self.Current.player == 1: + self.CurrentScore = self.Current.score[2]-self.Current.score[1] + def Make(self, r,c,o, player): # Function for generating a child node self.children[(r,c,o)] = ABNode(self.Current) move=(r,c,o) -- cgit v1.2.3