I need help making a score board for each round of my Tic Tac Toe game, I would like it so whenever a round ends it updates cscore (computer score)or pscore (player score) by 1.
Any feedback on my code would be greatly appreciated since I am fairly new to python.
I have put the score related code I already have below
import random
def main():
global cscore
cscore = 0
global pscore
pscore = 0
if turn == 'player':
drawBoard(theBoard)
move = getPlayerMove(theBoard)
makeMove(theBoard, playerLetter, move)
if isWinner(theBoard, playerLetter):
drawBoard(theBoard)
print('Hooray! You have won the game!')
pscore += 1
print(main)
gameIsPlaying = False
else:
if isBoardFull(theBoard):
drawBoard(theBoard)
print('The game is a tie!')
print(main)
break
else:
turn = 'computer'
else:
move = getComputerMove(theBoard, computerLetter)
makeMove(theBoard, computerLetter, move)
if isWinner(theBoard, computerLetter):
drawBoard(theBoard)
print('The computer has beaten you! You lose.')
cscore += 1
print(main)
gameIsPlaying = False
else:
if isBoardFull(theBoard):
drawBoard(theBoard)
print('The game is a tie!')
print(main)
break
else:
turn = 'player'
if not playAgain():
break
main()