diff options
author | Jack Vehmeier <vehme003@umn.edu> | 2021-04-26 21:42:49 -0500 |
---|---|---|
committer | Jack Vehmeier <vehme003@umn.edu> | 2021-04-26 21:42:49 -0500 |
commit | e840572a2e89f86522dfee7b6943831f03a93abe (patch) | |
tree | ef30ea3d696b57b459f63be205dc0b8559cfebf8 /python | |
parent | changed node stuff (diff) | |
download | csci4511w-e840572a2e89f86522dfee7b6943831f03a93abe.tar csci4511w-e840572a2e89f86522dfee7b6943831f03a93abe.tar.gz csci4511w-e840572a2e89f86522dfee7b6943831f03a93abe.tar.bz2 csci4511w-e840572a2e89f86522dfee7b6943831f03a93abe.tar.lz csci4511w-e840572a2e89f86522dfee7b6943831f03a93abe.tar.xz csci4511w-e840572a2e89f86522dfee7b6943831f03a93abe.tar.zst csci4511w-e840572a2e89f86522dfee7b6943831f03a93abe.zip |
fixed node again
Diffstat (limited to 'python')
-rw-r--r-- | python/alphaBeta.py | 13 |
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) |