def test_newboard(self): """New boards should be empty""" board = Board() self.assertEqual("".join(board.gs), " " * 9) for i in range(0, 9): board.inputMove(i, "X") board.__init__() self.assertEqual("".join(board.gs), " " * 9)
for event in pygame.event.get(): # OS level quit if event.type == QUIT: pygame.quit() sys.exit() # Mouse event handler if event.type == MOUSEBUTTONDOWN: pos = event.pos # Reset button handler if pos[0] > resetButton[0] and pos[0] < ( resetButton[0] + resetButton[2]) and pos[1] > resetButton[1] and pos[1] < ( resetButton[1] + resetButton[3]): board.__init__() initBoard() # Quit button handler if pos[0] > quitButton[0] and pos[0] < ( quitButton[0] + quitButton[2]) and pos[1] > quitButton[1] and pos[1] < ( quitButton[1] + quitButton[3]): pygame.quit() sys.exit() # Create 9 mouse handlers for handling different possible plays in tic tac toe for i in range(len(mo)): if pos[0] > mo[i][0] and pos[0] < mo[i][0] + 100 and pos[ 1] > mo[i][1] and pos[1] < mo[i][1] + 66: