Ejemplo n.º 1
0
    def test_invalid_protocol(self):
        player1 = GoPlayerBase()
        self.assertRaisesAny(player1.receive_stone, StoneEnum.BLACK)

        player2 = GoPlayerBase()
        player2.register()
        history = get_simple_history_3()
        self.assertRaisesAny(player2.choose_move, history)

        player3 = GoPlayerBase()
        self.assertRaisesAny(player3.choose_move, history)
Ejemplo n.º 2
0
    def test_receive_stone(self):
        player1 = GoPlayerBase("player1")
        player1.register()
        self.assertEqual(None, player1.stone_type)
        player1.receive_stone(StoneEnum.BLACK)
        self.assertEqual(StoneEnum.BLACK, player1.stone_type)

        player2 = GoPlayerBase("player2")
        player2.register()
        self.assertEqual(None, player2.stone_type)
        player2.receive_stone(StoneEnum.WHITE)
        self.assertEqual(StoneEnum.WHITE, player2.stone_type)
Ejemplo n.º 3
0
def init_player():
    player = GoPlayerBase()
    player.register()
    player.receive_stone(StoneEnum.BLACK)
    return player
Ejemplo n.º 4
0
 def test_register(self):
     player = GoPlayerBase()
     self.assertEqual("default_player", player.register())