Spec Sheet — Rock, Paper, Scissors
Project File: rock_paper_scissors.py
Platform: Console
Must Have: Validation, Random Choice, Win Logic, Score, Replay
Goal
Create a console game where the user plays Rock, Paper, Scissors against the computer.
Game Rules
- Rock beats Scissors
- Scissors beats Paper
- Paper beats Rock
- Same choice = Tie
Requirements
User Input
- Ask the user to enter:
rock,paper, orscissors - Input is case-insensitive (accept
Rock,ROCK, etc.) - If input is invalid, show an error message and ask again (input validation)
Computer Choice
- Computer randomly chooses rock/paper/scissors each round.
Round Result
- Display user choice, computer choice, and the result (Win/Lose/Tie).
Score Tracking
- Track: user wins, computer wins, ties.
- Display the scoreboard after each round.
Replay
- After each round, ask:
Play again? (y/n) - End when the user chooses
n
Final Output
- Print the final score and overall winner.
Optional Enhancements: Best-of-3 mode, win streaks, add “Lizard-Spock”, ASCII art, or difficulty levels.
Pseudocode
START
SET userWins = 0, computerWins = 0, ties = 0
SET options = ["rock", "paper", "scissors"]
LOOP:
ASK user for choice (rock/paper/scissors)
CONVERT user choice to lowercase
WHILE user choice not in options:
PRINT invalid input
ASK again
computerChoice = random choice from options
PRINT user choice and computerChoice
IF user choice == computerChoice:
ties++
PRINT "Tie"
ELSE IF (user choice beats computerChoice):
userWins++
PRINT "You win"
ELSE:
computerWins++
PRINT "Computer wins"
PRINT current scoreboard
ASK "Play again? (y/n)"
IF answer is "n":
BREAK loop
PRINT final scoreboard
DECLARE overall winner
END
Rubric (100 Points)
| Category | Excellent (Full Credit) | Points |
|---|---|---|
| Program Runs / No Errors | Runs cleanly with no crashes | 10 |
| Input Validation | Rejects invalid input and reprompts | 15 |
| Random Computer Choice | Uses random.choice() correctly |
10 |
| Correct Game Logic | Win/lose/tie logic is always correct | 20 |
| Output Clarity | Shows user choice, computer choice, and result | 10 |
| Score Tracking | Tracks wins/losses/ties accurately | 15 |
| Replay Feature | Loops rounds and exits cleanly on n |
10 |
| Final Summary | Prints final scoreboard + overall winner | 5 |
| Code Style | Good names, functions, comments, readable formatting | 5 |
| Total | 100 |
Actual Python Code — rock_paper_scissors.py
"""
File: rock_paper_scissors.py
Rock, Paper, Scissors (Console)
Skills:
- input validation
- conditionals (if/elif/else)
- loops
- random choice
- score tracking
Author: Joe Cusack
Date: 02/28/2026
"""
import random
def get_user_choice(options):
"""
Repeatedly prompt user until a valid choice is entered.
Returns a lowercase valid choice.
"""
while True:
choice = input("Enter rock, paper, or scissors: ").strip().lower()
if choice in options:
return choice
print("Invalid choice. Please type: rock, paper, or scissors.\n")
def get_winner(user_choice, computer_choice):
"""
Returns:
'tie', 'user', or 'computer'
"""
if user_choice == computer_choice:
return "tie"
# Winning conditions for the user
user_wins = (
(user_choice == "rock" and computer_choice == "scissors") or
(user_choice == "scissors" and computer_choice == "paper") or
(user_choice == "paper" and computer_choice == "rock")
)
return "user" if user_wins else "computer"
def play_again():
"""
Ask user if they want to play another round.
Returns True for yes, False for no.
"""
while True:
answer = input("Play again? (y/n): ").strip().lower()
if answer in ("y", "n"):
return answer == "y"
print("Please enter y or n.\n")
def main():
options = ["rock", "paper", "scissors"]
user_wins = 0
computer_wins = 0
ties = 0
print("=== Rock, Paper, Scissors ===\n")
while True:
user_choice = get_user_choice(options)
computer_choice = random.choice(options)
print(f"\nYou chose: {user_choice}")
print(f"Computer chose: {computer_choice}")
winner = get_winner(user_choice, computer_choice)
if winner == "tie":
ties += 1
print("Result: TIE!")
elif winner == "user":
user_wins += 1
print("Result: YOU WIN!")
else:
computer_wins += 1
print("Result: COMPUTER WINS!")
print("\n--- Scoreboard ---")
print(f"You: {user_wins}")
print(f"Computer: {computer_wins}")
print(f"Ties: {ties}")
print("------------------\n")
if not play_again():
break
print("\n=== Final Results ===")
print(f"You: {user_wins}")
print(f"Computer: {computer_wins}")
print(f"Ties: {ties}")
if user_wins > computer_wins:
print("Overall Winner: YOU!")
elif computer_wins > user_wins:
print("Overall Winner: COMPUTER!")
else:
print("Overall Winner: TIE!")
print("\nThanks for playing!")
if __name__ == "__main__":
main()
Run it: Save as
rock_paper_scissors.py and run with python rock_paper_scissors.py.