Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 131 - 2615_KEC
P. 131

    PROJECT 3: Rock Paper Scissors

                     Software Used: CodeSkulptor

                     Objective:

                     Create a Python program to simulate a simple rock-paper-scissors game by:
                         Accepting user input for rock, paper or scissors
                         Generating the computer's choice randomly
                         Using conditions to determine the winner
                     Use Codeskulptor3-https://py3.codeskulptor.org/
                     Step-by-Step Instructions: (Plan IPO)

                     1.  Input:
                             The user enters the choice of "rock as 1," "paper as 2," or "scissors as 3"  (dynamic - varies
                             with each user).
                             Computer will also make a choice using “Random” library reference.
                     2.  Process: Use conditions to determine the winner:
                         Rock beats scissors.      Scissors beat paper.      Paper beats rock.
                         If both choices are the same, it’s a tie.                                “Computer Wins”

                     3.  Output: Display who won or if it’s a tie. Refer to the sample
                             Code:                                              Flow:

                                                                           ENTER YOUR CHOICE: ROC

                                                                          COMPUTER MAKES A CHOICE

                                                                              DID YOU CHOICE
                                                                               ROCK, PAPER,
                                                                                SCISSORS

                                                            ROCK                 PAPER               SCISSORS

                                                           DID THE              DID THE               DID THE
                                                          COMPUTER             COMPUTER              COMPUTER
                                                         CHOOSE ROCK,         CHOOSE ROCK,          CHOOSE ROCK,
                                                         PAPER, SCISSORS      PAPER, SCISSORS      PAPER, SCISSORS

                                              ROCK  PAPER SCISSORS  PAPER  SCISSORS  ROCK  SCISSORS    ROCK      PAPER
                                                IT'S A TIE!  YOU LOSE!  YOU WIN!  YOU WIN!  YOU LOSE!  YOU LOSE!  YOU WIN!

                     Bonus Feature:

                         Replay Option: Add a loop to let the user play multiple rounds.
                         Score Tracking: Implement a scoring system to keep track of wins, losses and ties.
                         Custom Messages: Add messages for streaks or consistent wins.
                         Validation: Ensure the user enters a valid number (1, 2 or 3).

                                                                                            Control Structures in Python  129

| 126 127 128 129 130 131 132 133 134 135 136 |