Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class TicTacToe:
- def __init__(self, game_state):
- self.game_state = game_state
- def determine_winner(self):
- """Finds winner
- Returns:
- "X", "0", or None if a winning move has been
- made horizontally, vertically, or diagonally
- """
- return True
- def print_board(self):
- """Prints the board
- Returns:
- An easily readable formatted board state
- X O X
- O O X
- O X X
- """
- return ""
- TEST_VERTICAL_WINNER = [1, 0, 1, 0, 0, 1, 0, 1, 1]
- TEST_HORIZONTAL_WINNER = [0, 1, 0, 1, 0, 0, 1, 1, 1]
- TEST_DIAGONAL_WINNER = [1, 0, 0, 1, 0, 1, 0, 1, 1]
- TEST_INCOMPLETE_WINNER = [1, 0, 1, None, 0, None, 0, 0, 1]
- TEST_NO_WINNER = [1, 0, 1, None, 0, None, 0, 1, 1]
- print(TicTacToe(TEST_VERTICAL_WINNER).determine_winner() == "X")
- print(TicTacToe(TEST_HORIZONTAL_WINNER).determine_winner() == "X")
- print(TicTacToe(TEST_DIAGONAL_WINNER).determine_winner() == "O")
- print(TicTacToe(TEST_INCOMPLETE_WINNER).determine_winner() == "O")
- print(TicTacToe(TEST_NO_WINNER).determine_winner() is None)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement