SHARE
TWEET

Untitled

a guest Nov 12th, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class TicTacToe:
  2.  
  3.    def __init__(self, game_state):
  4.        self.game_state = game_state
  5.  
  6.    def determine_winner(self):
  7.     """Finds winner
  8.      
  9.     Returns:
  10.     "X", "0", or None if a winning move has been
  11.         made horizontally, vertically, or diagonally
  12. """
  13.        return True
  14.  
  15.    def print_board(self):
  16.     """Prints the board
  17.  
  18.     Returns:
  19.             An easily readable formatted board state
  20.                X O X
  21.                O O X
  22.                O X X
  23.     """
  24.     return ""
  25.  
  26. TEST_VERTICAL_WINNER = [1, 0, 1, 0, 0, 1, 0, 1, 1]
  27. TEST_HORIZONTAL_WINNER = [0, 1, 0, 1, 0, 0, 1, 1, 1]
  28. TEST_DIAGONAL_WINNER = [1, 0, 0, 1, 0, 1, 0, 1, 1]
  29. TEST_INCOMPLETE_WINNER = [1, 0, 1, None, 0, None, 0, 0, 1]
  30. TEST_NO_WINNER = [1, 0, 1, None, 0, None, 0, 1, 1]
  31. print(TicTacToe(TEST_VERTICAL_WINNER).determine_winner() == "X")
  32. print(TicTacToe(TEST_HORIZONTAL_WINNER).determine_winner() == "X")
  33. print(TicTacToe(TEST_DIAGONAL_WINNER).determine_winner() == "O")
  34. print(TicTacToe(TEST_INCOMPLETE_WINNER).determine_winner() == "O")
  35. print(TicTacToe(TEST_NO_WINNER).determine_winner() is None)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top