diff options
author | Matt Strapp <strap012@umn.edu> | 2021-04-26 14:52:40 -0500 |
---|---|---|
committer | Matt Strapp <strap012@umn.edu> | 2021-04-26 15:03:24 -0500 |
commit | c4e01e7d1d6f670410a416227b70d2950451f68a (patch) | |
tree | 39ded728d30ebf5f73d2053c546bc3972c501b84 /python | |
parent | Add debug configs, (diff) | |
download | csci4511w-c4e01e7d1d6f670410a416227b70d2950451f68a.tar csci4511w-c4e01e7d1d6f670410a416227b70d2950451f68a.tar.gz csci4511w-c4e01e7d1d6f670410a416227b70d2950451f68a.tar.bz2 csci4511w-c4e01e7d1d6f670410a416227b70d2950451f68a.tar.lz csci4511w-c4e01e7d1d6f670410a416227b70d2950451f68a.tar.xz csci4511w-c4e01e7d1d6f670410a416227b70d2950451f68a.tar.zst csci4511w-c4e01e7d1d6f670410a416227b70d2950451f68a.zip |
Start work on AB
Diffstat (limited to '')
-rw-r--r-- | python/agent_AB.py | 4 | ||||
-rw-r--r-- | python/agent_MCTS.py | 2 | ||||
-rw-r--r-- | python/alphaBeta.py | 6 |
3 files changed, 8 insertions, 4 deletions
diff --git a/python/agent_AB.py b/python/agent_AB.py index 4b1ace1..5564f11 100644 --- a/python/agent_AB.py +++ b/python/agent_AB.py @@ -1,10 +1,10 @@ +from python.alphaBeta import AlphaBeta import dotsandboxes.dotsandboxesagent as dba import sys import argparse import logging from GameState import GameState, DotsAndBoxesState -from MCTS import MCTSNode, MCTSGameController import alphaBeta @@ -18,7 +18,7 @@ class Agent(dba.DotsAndBoxesAgent): super(Agent, self).__init__(player, nb_rows, nb_cols, timelimit) self.GameStateClass = DotsAndBoxesState self.game_state = self.GameStateClass(nb_rows, nb_cols, player) - # self.controller = controller + self.controller = AlphaBeta() def register_action(self, row, column, orientation, player): super(Agent, self).register_action(row, column, orientation, player) diff --git a/python/agent_MCTS.py b/python/agent_MCTS.py index b0072cf..b60f5ec 100644 --- a/python/agent_MCTS.py +++ b/python/agent_MCTS.py @@ -5,8 +5,6 @@ import argparse import logging from GameState import GameState, DotsAndBoxesState from MCTS import MCTSNode, MCTSGameController -import alphaBeta - logger = logging.getLogger(__name__) games = {} diff --git a/python/alphaBeta.py b/python/alphaBeta.py index 31fa578..8e041fe 100644 --- a/python/alphaBeta.py +++ b/python/alphaBeta.py @@ -1,3 +1,9 @@ +from GameState import GameState +class GameController(object): + def get_next_move(self, state): + # when you get a new move, it is assumed that the game is not ended yet + assert state.get_moves() + def alpha_beta(node, alpha, beta): |