def simngames(nprobaprobb)simulates games and returns winsa and winsb winsa winsb for in range( )scoreascoreb simonegame(probaprobbmain winsa winsb proba probb printintro getinputs proba probb winsa winsb simngames printsummary proba probb scorea scoreb simonegame figure level structure chart for racquetball simulation finallywe need to check the scores to see who won and update the appropriate accumulator here is the resultdef simngames(nprobaprobb)winsa winsb for in range( )scoreascoreb simonegame(probaprobbif scorea scorebwinsa winsa elsewinsb winsb return winsawinsb third-level design everything seems to be coming together nicely let' keep working on the guts of the simulation the next obvious point of attack is simonegame here' where we actually have to code up the logic of the racquetball rules players keep doing rallies until the game is over that suggests some kind