rock_paper_scissors / README.md
trtd56's picture
Translate README and index.html to English, add instructions section
16172a3
metadata
title: Rock Paper Scissors
emoji: ✊✌️🖐️
colorFrom: pink
colorTo: purple
sdk: static
pinned: false
short_description: Play rock-paper-scissors with Reachy Mini robot
tags:
  - reachy_mini
  - reachy_mini_python_app
  - gesture-recognition
  - mediapipe
  - computer-vision
license: mit

Rock Paper Scissors - Reachy Mini

A gesture-based rock-paper-scissors game to play with the Reachy Mini robot.

Overview

An intuitive rock-paper-scissors game designed for children. Play using only gestures, sounds, and movements - no screen or language dependency required.

Key Features

  • Gesture Recognition: Real-time hand detection using MediaPipe
  • Audio Feedback: R2-D2 style sound effects
  • Robot Animations: Expressive head and antenna movements
  • Web Interface: Real-time status display for debugging

How to Play

  1. Start Game: Wave your hand at Reachy Mini's camera
  2. Countdown: Count down together with the robot
  3. Play: Show Rock ✊, Paper ✋, or Scissors ✌️
  4. Result: Win, lose, or draw is displayed with animations and sounds

Installation

Prerequisites

  • Python 3.10 or higher
  • Reachy Mini SDK
  • Camera device

Package Installation

# Clone the repository
git clone https://huggingface.co/spaces/trtd56/rock_paper_scissors

# Navigate to directory
cd rock_paper_scissors

# Install (development mode)
pip install -e .

# Optional: Development dependencies
pip install -e ".[dev]"

# Optional: Audio features
pip install -e ".[audio]"

Model Files

The MediaPipe model required for hand detection is automatically downloaded on first run.

To download manually:

mkdir -p rock_paper_scissors/models
curl -L -o rock_paper_scissors/models/hand_landmarker.task \
  https://storage.googleapis.com/mediapipe-models/hand_landmarker/hand_landmarker/float16/latest/hand_landmarker.task

Usage

Run with Reachy Mini

reachy-mini run rock_paper_scissors

Web Interface

After starting, access in your browser:

http://localhost:8042

Project Structure

rock_paper_scissors/
├── rock_paper_scissors/
│   ├── main.py              # Application entry point
│   ├── config/              # Configuration management
│   │   └── settings.py
│   ├── detection/           # Hand & gesture detection
│   │   ├── hand_detector.py
│   │   ├── gesture_detector.py
│   │   ├── wave_detector.py
│   │   └── motion_detector.py
│   ├── game/                # Game logic
│   │   ├── state_machine.py
│   │   ├── game_logic.py
│   │   └── states.py
│   ├── robot/               # Robot control
│   │   ├── animations.py
│   │   ├── head_poses.py
│   │   └── antenna_poses.py
│   ├── audio/               # Sound management
│   │   ├── sound_manager.py
│   │   └── sounds.py
│   └── static/              # Web interface
│       ├── index.html
│       ├── style.css
│       └── main.js
├── tests/                   # Test suite
├── pyproject.toml
└── README.md

Configuration

Configurable settings in rock_paper_scissors/config/settings.py:

Setting Description Default
detection.min_detection_confidence Minimum hand detection confidence 0.5
detection.min_tracking_confidence Minimum tracking confidence 0.5
audio.volume Sound volume (0.0-1.0) 0.7
game.countdown_duration Countdown duration (seconds) 3

Testing

# Run all tests
pytest

# Run with coverage
pytest --cov=rock_paper_scissors --cov-report=html

Tech Stack

Game States

IDLE (Waiting)
  ↓ Wave hand
COUNTDOWN
  ↓ 3, 2, 1...
DETECT_GESTURE
  ↓ Rock/Paper/Scissors
RESULT
  ↓ Win/Lose/Draw
IDLE (Return to waiting)

License

MIT License

Related Links