import random as rnd def introduction(): #print game introductory information print("what is happening") print("what will 'go-on'") print() print() def getInputs(): #get three values used for game simulation n = int(input("Enter the number of games to be played: ")) probAWins=float(input("Enter the probability player A wins a serve: ")) probBWins=float(input("Enter the probability player B wins a serve: ")) return probAWins,probBWins,n def playNGames(n,probAWins,probBWins): #simulate n raquetball games winsA=0 winsB=0 for gameNumber in range(n): scoreA,scoreB = playGame(probAWins,probBWins) if scoreA > scoreB: winsA=winsA+1 else: winsB=winsB+1 return winsA,winsB def playGame(probAWins,probBWins): # simulate one raquetball game serving = "A" scoreA,scoresB=0,0 while not gameOver(scoreA,scoresB): if serving == "A": if rnd.random() < probAWins: scoreA=scoreA+1 else: serving="B" else: if rnd.random() < probBWIns: scoreB=scoreB+1 else: serving = "A" return scoreA,scoreB def gameOver(scoreA,scoreB): #check to see if either play has 15 points return ((scoreA==15) or (scoreB==15)) def printSummary(winsA,winsB): print("stuff") print("stuff") def main(): introduction() probAwins,probBwins,n=getInputs() winsA,winsB=playNGames(n,probAwins,probBwins) printSummary(winsA,winsB)