aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Vehmeier <vehme003@umn.edu>2021-04-26 21:12:25 -0500
committerJack Vehmeier <vehme003@umn.edu>2021-04-26 21:12:25 -0500
commit50d2c4987ded30b666bb1c9e8e2a5f9d49048ec5 (patch)
tree6cde07be91a9b749e11214673c4207b956d5e0aa
parenti added a space (diff)
downloadcsci4511w-50d2c4987ded30b666bb1c9e8e2a5f9d49048ec5.tar
csci4511w-50d2c4987ded30b666bb1c9e8e2a5f9d49048ec5.tar.gz
csci4511w-50d2c4987ded30b666bb1c9e8e2a5f9d49048ec5.tar.bz2
csci4511w-50d2c4987ded30b666bb1c9e8e2a5f9d49048ec5.tar.lz
csci4511w-50d2c4987ded30b666bb1c9e8e2a5f9d49048ec5.tar.xz
csci4511w-50d2c4987ded30b666bb1c9e8e2a5f9d49048ec5.tar.zst
csci4511w-50d2c4987ded30b666bb1c9e8e2a5f9d49048ec5.zip
changed node stuff
-rw-r--r--python/alphaBeta.py22
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()