def test_draw(self): """Confirm Board object correctly determines a draw state""" board = Board() self.assertFalse(board.checkForDraw()) for i in range(0,9): board.inputMove(i, "X") self.assertTrue(board.checkForDraw())
if (board.gs[i] == " "): # Draw the X pygame.draw.line(disp, green, (mo[i][0] + 25, mo[i][1] + 15), (mo[i][0] + 75, mo[i][1] + 55), 6) pygame.draw.line(disp, green, (mo[i][0] + 25, mo[i][1] + 55), (mo[i][0] + 75, mo[i][1] + 15), 6) board.inputMove(i, player) # Check for win condition if board.checkForWinner(player): displayMessage("You win!!", green, black, fontObj, 200, 340) # Check for draw so we can skip computers turn elif board.checkForDraw(): displayMessage("Looks like a cats game!!", white, black, fontObj, 250, 340) elif (board.playAgain == " "): cmove = board.moveAI(comp, player) board.inputMove(cmove, comp) # Draw the O pygame.draw.circle( disp, red, (mo[cmove][0] + 50, mo[cmove][1] + 35), 25, 6) if board.checkForWinner(comp): displayMessage("You lose!!", red, black, fontObj, 200, 340)