Design a python program that simulates the game rock, paper, and scissors. You are to keep track of your wins, losses, and ties. You are to allow the users to play over and over again until he or she...

1 answer below »
DUMMY


Design a python program that simulates the game rock, paper, and scissors.  You are to keep track of your wins, losses, and ties.  You are to allow the users to play over and over again until he or she decides to quit.  After each throw, you will display the results of the throw followed by the current win, loss, tie numbers.  A throw consists of the player picking either Rock, Paper, or Scissors followed by the computer randomly choosing Rock, Paper, or Scissors. Rules of the game: Rock beats Scissors. Paper beats Rock. Scissor beats paper. MENU: 1. Throw Rock 2. Throw Paper 3. Throw Scissors 4. Quit Sample Run: Option 1: == RESULTS == Computer Throws Scissors, you win Wins…………………...:1 Losses………………...: 0 Ties…………………..: 0 Longest Win Streak....: 1 Longest Lose Streak..: 0 Note: After each Throw you will display the results from above Assignment 6: Resources: Chapter 12: JavaFX: GUI Programming and Basic Controls Use Net Beans or Eclipse and any Java Compiler to complete the following programs. Submission: You need to add the screenshots for each question along with the source code. Hint: Use the comments in the source code. Complete both Questions 2 & 8.
Answered 25 days AfterJul 23, 2021

Answer To: Design a python program that simulates the game rock, paper, and scissors. You are to keep track of...

Mohit answered on Aug 18 2021
149 Votes
Rock, Paper, Scissors Game Design in Python
Design a python program that simulates the game rock, paper, and scissors.  You are to keep track of your wins, losses, and ties.  You are to allow the users to play over and over again until he or she decides to quit.  After each throw, you will
display the results of the throw followed by the current win, loss, tie numbers.  A throw consists of the player picking either Rock, Paper, or Scissors followed by the computer randomly choosing Rock, Paper, or Scissors.
Rules of the game:
Rock beats Scissors.
Paper beats Rock.
Scissor beats paper.
MENU:
1. Throw Rock
2. Throw Paper
3. Throw Scissors
4. Quit
Sample Run:
    Option 1:
    == RESULTS ==
Computer Throws Scissors, you win
Wins…………………...:        1
Losses………………...:     0
Ties…………………..:         0
Longest Win Streak....:     1
Longest Lose Streak..:     0
Note: After each Throw you will display the results from above
Requirements Specifications: For solving this assignment we need following resources:
a programming language, an IDE to write your code for eg. (Pycharm, Anaconda for python language), (codeblock for C++).
I have used python language and Anaconda as IDE
Source Code:
import random
def print_result( Losses,Wins,Ties,max_winstreak,max_losestreak ):
print("Losses--------------- : ",Losses)
print("Wins--------------- : ",Wins)
print("Ties--------------- : ",Ties)
print("Longest Win Streak--: ",max_winstreak)
print("Longest Lose Streak--: ",max_losestreak)
print()
print("====================================================")

def play_game():
options = {1:'Rock', 2:'Paper', 3:'Scissors', 4:'Quit'}
keys = list(options.keys())
print("MENU :")
print("1. Throw Rock \n2. Throw Paper \n3. Throw Scissors \n4. Quit")
chosen_option = -1
Ties = 0
Losses = 0
Wins = 0
max_winstreak = 0
max_losestreak = 0
current_winstreak = 0
current_losestreak = 0
while chosen_option != 4:
    chosen_option = int(input('Choose your option : '))
computer = random.choice(keys)
print("Option ",chosen_option,":")
if chosen_option == 4:
        print("QUIT")
    break

print("==RESULTS==")
if chosen_option == 1:
        if computer==chosen_option:
        Ties = Ties + 1
        if max_winstreak < current_winstreak:
            max_winstreak = current_winstreak
        if max_losestreak < current_losestreak:
            max_losestreak = current_losestreak
        current_winstreak = 0
        current_losestreak = 0
        print("computer throws "+ options[chosen_option]+",Match Tie")
        print()
...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here