Пример #1
0
    def test_get_empty_positions(self):

        board = Board()

        board.move(PLAYER1, 2, 1)
        board.move(PLAYER2, 1, 0)

        emptyPositions = board.get_empty_positions()

        assert [1, 0] not in emptyPositions
        assert [2, 1] not in emptyPositions
Пример #2
0
    def test_checkStatus_tie(self):

        board = Board()

        board.move(PLAYER1, 0, 0)
        board.move(PLAYER1, 0, 1)
        board.move(PLAYER2, 0, 2)
        board.move(PLAYER2, 1, 0)
        board.move(PLAYER1, 1, 1)
        board.move(PLAYER1, 1, 2)
        board.move(PLAYER1, 2, 0)
        board.move(PLAYER2, 2, 1)
        board.move(PLAYER2, 2, 2)

        emptyPositions = board.get_empty_positions()

        assert len(emptyPositions) == 0
        assert board.checkStatus() == 0
Пример #3
0
    def test_move(self):

        board = Board()
        board.move(PLAYER1, 2, 1)
        assert board.board_state[2][1] == PLAYER1