示例#1
0
 def test_mcts_situation_2(self, engine, agent):
     # agent should continue because of good dice
     dice_ = engine.Die(5), engine.Die(5)
     board = engine.Board(state=(0, 4, 50), dice=dice_)
     game = engine.init_game(board=board)
     move = agent.next_move(game)
     assert move == 'c'
示例#2
0
 def test_mcts_situation_1(self, engine, agent):
     # agent should reroll because of bad dice
     dice_ = engine.Die(2), engine.Die(2)
     board = engine.Board(state=(0, 4, 50), dice=dice_)
     game = engine.init_game(board=board)
     move = agent.next_move(game)
     assert move == 'r'
示例#3
0
 def test_mcts_situation_3(self, engine, agent):
     # even though the agent has a good roll, it should reroll
     # because it can only win with at least 11
     dice_ = engine.Die(5), engine.Die(5)
     board = engine.Board(state=(39, 49, 50), dice=dice_)
     game = engine.init_game(board=board)
     move = agent.next_move(game)
     assert move == 'r'
示例#4
0
 def test_mcts_situation_4(self, engine, agent):
     # similar situation as the last one but since there is still
     # some way left before the game ends, the agent should keep
     # the good 10 this time
     dice_ = engine.Die(5), engine.Die(5)
     board = engine.Board(state=(39, 49, 100), dice=dice_)
     game = engine.init_game(board=board)
     move = agent.next_move(game)
     assert move == 'c'
示例#5
0
 def test_mcts_situation_5(self, engine, agent):
     # agent should keep because it will reach 48, which is a
     # guaranteed win next round. There is no risk since the
     # opponent cannot win this round. If the agent rerolls,
     # however, it could still lose with some bad rolls (e.g. d1,d1
     # and d1,d1).
     dice_ = engine.Die(3), engine.Die(2)
     board = engine.Board(state=(43, 37, 50), dice=dice_)
     game = engine.init_game(board=board)
     move = agent.next_move(game)
     assert move == 'c'