diff options
author | Jack Vehmeier <vehme003@umn.edu> | 2021-04-27 23:08:41 -0500 |
---|---|---|
committer | Jack Vehmeier <vehme003@umn.edu> | 2021-04-27 23:08:41 -0500 |
commit | 16497d70e2d4f9e7568d56e5bc791fcd0a625a4f (patch) | |
tree | ea4336d2a3baad9cc1bc2a6a7d7254eea81baf41 /python | |
parent | Change some stuff (diff) | |
download | csci4511w-16497d70e2d4f9e7568d56e5bc791fcd0a625a4f.tar csci4511w-16497d70e2d4f9e7568d56e5bc791fcd0a625a4f.tar.gz csci4511w-16497d70e2d4f9e7568d56e5bc791fcd0a625a4f.tar.bz2 csci4511w-16497d70e2d4f9e7568d56e5bc791fcd0a625a4f.tar.lz csci4511w-16497d70e2d4f9e7568d56e5bc791fcd0a625a4f.tar.xz csci4511w-16497d70e2d4f9e7568d56e5bc791fcd0a625a4f.tar.zst csci4511w-16497d70e2d4f9e7568d56e5bc791fcd0a625a4f.zip |
alphabeta is closer
Diffstat (limited to '')
-rw-r--r-- | python/GameState.py | 4 | ||||
-rw-r--r-- | python/agent_AB.py | 2 | ||||
-rw-r--r-- | python/alphaBeta.py | 2 |
3 files changed, 5 insertions, 3 deletions
diff --git a/python/GameState.py b/python/GameState.py index 8957f7c..6047f8d 100644 --- a/python/GameState.py +++ b/python/GameState.py @@ -38,9 +38,11 @@ class DotsAndBoxesState(GameState): self.board = rows self.score = {1: 0, 2: 0} self.player = player - print("Player: ", player) + #print("Player: ", player) @property + def get_cur(self): + return DotsAndBoxesState(self.nb_rows, self.nb_cols, self.player) def game_result(self): def game_decided(nb_cols, nb_rows, scoreP, scoreO): # the game is decided if the winner is already known even before the game is ended diff --git a/python/agent_AB.py b/python/agent_AB.py index 4107156..2357d45 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, 3) + r, c, o = self.controller.miniMax(self.game_state, 4) return r, c, o def end_game(self): diff --git a/python/alphaBeta.py b/python/alphaBeta.py index fb89ab0..5d7b932 100644 --- a/python/alphaBeta.py +++ b/python/alphaBeta.py @@ -26,7 +26,7 @@ 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) + self.children[(r,c,o)] = ABNode(self.Current.get_cur) move=(r,c,o) self.children[(r,c,o)].Current.play_move(move) self.children[(r,c,o)].update_score() |