From 50d2c4987ded30b666bb1c9e8e2a5f9d49048ec5 Mon Sep 17 00:00:00 2001 From: Jack Vehmeier Date: Mon, 26 Apr 2021 21:12:25 -0500 Subject: changed node stuff --- python/alphaBeta.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'python') 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() -- cgit v1.2.3