The main program initializes the final scores, starts the game loop where the matches are played, updating the scores appropriately, and then displays the winner.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Once the lower level functions are written and tested, they are ready to be combined to produce the game. The game loop is where the game is played. A point is awarded to the winner of each round and then added to the total for that contestant (computer or player). If the round is a draw, no points are awarded. The player determines how many rounds are to be played by entering the choice of 1, 2, or 3 (1 for Rock, 2 for Paper, 3 for Scissors) or by entering a 0 to end the contest. Once the contest is over, the winner is displayed.

Most of the work has already been completed in the lower level tasks. The main program initializes the final scores, starts the game loop where the matches are played, updating the scores appropriately, and then displays the winner.

Here is a pseudocode algorithm showing how to set up the game loop:

Write ("Rock, Paper, Scissors Tournament")

computerTotal = 0

playerTotal = 0

playerChoice = playerSelection()

while (playerChoice != 0)

computerChoice = computerSelection()

winner = roundWinner(computerChoice, playerChoice)

if (winner == 'computer')

computerTotal = computerTotal + 1

else if (winner == 'player')

playerTotal = playerTotal + 1

playerChoice = playerSelection()

matchWinner(computerTotal, playerTotal)

PYTHON

Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Function Arguments
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education