예제 #1
0
def mm_find_best():
    """MiniMax find best move (max_layers=3)."""
    t = mm_tg()
    t.vline(3, 0, 15, t.body_of(1))

    mm = MiniMax(t, mm_player())
    mm.find_best_move(max_layers=3)
예제 #2
0
def test_catch(tg, player):
    """Test catching the other player."""
    tg.vline(3, 0, 15, tg.body_of(1))
    mm = MiniMax(tg, player)

    weight, move = mm.find_best_move(max_layers=3)
    assert move == 'LEFT'
예제 #3
0
 def go(self):
     """Act depending if we see others."""
     if self.can_see_others():
         mm = MiniMax(self.grid, self.players[self.my_number],
                 full_bfs=self.full_bfs)
         weight, move = mm.find_best_move(max_layers=self.max_layers,
                 max_layer_size=self.max_layer_size)
         mm.unlink_states()
         if weight > 0:
             return move
     return self.go_wander()