aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/alphaBeta.py13
1 files changed, 11 insertions, 2 deletions
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)