diff options
Diffstat (limited to 'python/alphaBeta.py')
-rw-r--r-- | python/alphaBeta.py | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/python/alphaBeta.py b/python/alphaBeta.py index 214ed23..b35a7f2 100644 --- a/python/alphaBeta.py +++ b/python/alphaBeta.py @@ -12,18 +12,18 @@ class GameController(object): class ABNode(object): # A class for Node related operations def __init__(self, state): self.Current = state - self.CurrentScore = 0 + self.CurrentScore = self.Current.score[1]-self.Current.score[2] self.children = {} - - def Make(self, i, j, player): # Function for generating a child node - self.children[(i, j)] = ABNode(self.Current.Get_currentState()) - mul = 1 - if player: - mul *= -1 - self.children[(i, j)].CurrentScore = (self.children[(i, j)].Current.action(i, j) * mul) + self.CurrentScore - - def Populate(self, i, j, Child): # Function for adding a node - self.children[(i,j)] = Child + def update_score(self): + self.CurrentScore = self.Current.score[1]-self.Current.score[2] + 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) + self.children[(r,c,o)].play_move(move) + self.children[(r,c,o)].update_score() + + def Populate(self, r,c,o, Child): # Function for adding a node + self.children[(r,c,o)] = Child def Draw(self): # function for drawing the board self.Current.Draw_mat() |