Beispiel #1
0
    def test_nonempty_board(self):
        tictactoe_board = TicTacToeBoard(4, False, None)
        tictactoe_board.board[0][0] = 1
        tictactoe_board.board[1][2] = 2
        tictactoe_board.board[2][1] = 1

        self.assertEqual(tictactoe_board.get_empty_squares(), [(0, 1), (0, 2),
                                                               (0, 3), (1, 0),
                                                               (1, 1), (1, 3),
                                                               (2, 0), (2, 2),
                                                               (2, 3), (3, 0),
                                                               (3, 1), (3, 2),
                                                               (3, 3)])

        tictactoe_board.board[1][3] = 2
        tictactoe_board.board[3][0] = 2
        tictactoe_board.board[2][3] = 1

        self.assertEqual(tictactoe_board.get_empty_squares(), [(0, 1), (0, 2),
                                                               (0, 3), (1, 0),
                                                               (1, 1), (2, 0),
                                                               (2, 2), (3, 1),
                                                               (3, 2), (3, 3)])
Beispiel #2
0
    def test_empty_board(self):
        tictactoe_board = TicTacToeBoard(2, False, None)

        self.assertEqual(tictactoe_board.get_empty_squares(), [(0, 0), (0, 1),
                                                               (1, 0), (1, 1)])