aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Vehmeier <vehme003@umn.edu>2021-04-28 15:51:33 -0500
committerJack Vehmeier <vehme003@umn.edu>2021-04-28 15:51:33 -0500
commit216e2e9a1a5ada9d224afaff1441defd0fb455f5 (patch)
tree496b715da0edb24fe3579f8df7e8d4baa5541e64
parentalphabeta is closer (diff)
downloadcsci4511w-216e2e9a1a5ada9d224afaff1441defd0fb455f5.tar
csci4511w-216e2e9a1a5ada9d224afaff1441defd0fb455f5.tar.gz
csci4511w-216e2e9a1a5ada9d224afaff1441defd0fb455f5.tar.bz2
csci4511w-216e2e9a1a5ada9d224afaff1441defd0fb455f5.tar.lz
csci4511w-216e2e9a1a5ada9d224afaff1441defd0fb455f5.tar.xz
csci4511w-216e2e9a1a5ada9d224afaff1441defd0fb455f5.tar.zst
csci4511w-216e2e9a1a5ada9d224afaff1441defd0fb455f5.zip
fixed
-rw-r--r--python/GameState.py2
-rw-r--r--python/agent_AB.py2
-rw-r--r--python/alphaBeta.py3
3 files changed, 4 insertions, 3 deletions
diff --git a/python/GameState.py b/python/GameState.py
index 6047f8d..9e780a9 100644
--- a/python/GameState.py
+++ b/python/GameState.py
@@ -81,7 +81,7 @@ class DotsAndBoxesState(GameState):
def play_move(self, move):
r, c, o = move
- assert move in self.get_moves()
+ #assert move in self.get_moves()
# check if this move makes a box
makes_box = False
diff --git a/python/agent_AB.py b/python/agent_AB.py
index 2357d45..4107156 100644
--- a/python/agent_AB.py
+++ b/python/agent_AB.py
@@ -27,7 +27,7 @@ class Agent(dba.DotsAndBoxesAgent):
self.game_state.play_move(move)
def next_action(self):
- r, c, o = self.controller.miniMax(self.game_state, 4)
+ r, c, o = self.controller.miniMax(self.game_state, 3)
return r, c, o
def end_game(self):
diff --git a/python/alphaBeta.py b/python/alphaBeta.py
index 5d7b932..aab2a2a 100644
--- a/python/alphaBeta.py
+++ b/python/alphaBeta.py
@@ -26,7 +26,8 @@ class ABNode(object): # A class for Node related operations
self.CurrentScore = self.Current.score[2]-self.Current.score[1]
def Make(self, r,c,o): # Function for generating a child node
- self.children[(r,c,o)] = ABNode(self.Current.get_cur)
+ lit=deepcopy(self.Current)
+ self.children[(r,c,o)] = ABNode(lit)
move=(r,c,o)
self.children[(r,c,o)].Current.play_move(move)
self.children[(r,c,o)].update_score()