Skip to content

Rock Paper Scissors

Goal: Students write a repeated Rock Paper Scissors game and then extend the rule system.

Duration: 1-2 class hours.

Prerequisites: Conditionals, input, loops, random choice.

Overview

The base program plays Rock Paper Scissors between a human and the computer in a best-two-out-of-three match. The extension expands the rule set to Rock Paper Scissors Lizard Spock.

Learning Objectives

  • Represent player choices.
  • Compare two actions with explicit rules.
  • Handle ties.
  • Repeat rounds until a stopping condition is reached.
  • Extend a program by changing the rules without changing the entire structure.

Lesson Flow

  1. Students run a quick class tournament without code.
  2. The class writes out the win/loss/tie rules.
  3. Students implement one round.
  4. Students add scorekeeping and a match loop.
  5. Students extend the rule set.

Extension Rules

Rock Paper Scissors Lizard Spock has five gestures. Each gesture beats two options and loses to two options:

Gesture Beats
Rock Scissors, Lizard
Paper Rock, Spock
Scissors Paper, Lizard
Lizard Spock, Paper
Spock Scissors, Rock

Continuity

This module prepares students for explicit rule systems. Tic-Tac-Toe uses the same kind of thinking, but with board state instead of a single gesture.