Simon Says 1v1

Introduction

Project Overview: This project is an interactive game called Simon Says 1v1, built using the Arduino platform. It is a competitive memory game designed for two players, where each player takes turns repeating an increasingly complex sequence of lights and sounds. The game continues until one player makes a mistake, and the other is declared the winner.

What it does: The game generates a random sequence of LED flashes and sound tones. Players must replicate the sequence by pressing buttons that correspond to each LED. The system automatically checks for mistakes and keeps track of whose turn it is.

Purpose: The goal is to create a fun, fast-paced game that improves players’ memory, reaction time, and focus, while also providing a competitive multiplayer experience.

The idea behind it: The concept started from the classic Simon Says game, but I wanted to enhance it by turning it into a 1v1 challenge. This makes it more engaging and encourages interaction between players.

Why it’s useful: This project is both entertaining and educational. It helps players train their memory and reflexes, and for us, it was a great way to improve our understanding of microcontroller programming, real-time interaction, and electronics.

Description

HARDWARE

SOFTWARE

Hardware Design

Components:

- Arduino Mega 2560 R3

- Push Button x8

- LEDS:

  1. 5 mm Green LED with Diffused Lens x2
  2. 5 mm Yellow LED with Diffused Lens x2
  3. 5 mm Red LED with Diffused Lens x2
  4. 5 mm Blue LED with Diffused Lens x2

- Male-Male Wires

- 2.2K Ω Resistor x8

- 3 V or 3.3V Passive Buzzer

Electrical Scheme:

Software Design

IDE:

Arduino IDE

Platform: Arduino Mega

Programming language: C/C++ with Arduino core

Serial Monitor used for debugging and feedback

Data Structures:

- int sequence[]: holds the sequence of LED/button indices

- int playerInputs[]: stores player responses

Algorithms:

- Random sequence generator: generateSequence() generates a sequence using random()

- Sequential LED display with timing: LED patterns displayed with delay

- Input verification algorithm: compares player inputs to generated sequence

- Scoring system: increments player scores on success

- Game state machine: manages rounds, turns, and game over conditions

- PWM brightness control for LEDs

- Timeout-based input wait: waitForChoice() uses millis() for timing player responses

Pseudocode:

START game
INIT hardware (LEDs, buttons, PWM, Timer, Serial)
LOOP until gameOver:
  FOR each round:
    SET currentPlayer to 1
    generateSequence()
    displaySequence()
    INCREMENT sequence length
    IF player 1 fails → gameOver = true
    WAIT
    SET currentPlayer to 2
    displaySequence()
    INCREMENT sequence length
    IF player 2 fails → gameOver = true
    IF both players succeeded
      CONTINUE
DISPLAY winner
WAIT for any button press
RESET game state
RESTART game

Results

The project works as intended: the game correctly handles player turns, detects mistakes, increases difficulty, and displays the winner. All hardware components function properly, and the game resets and restarts as expected.

Conclusions

The project successfully demonstrates the use of microcontroller peripherals to create an interactive memory game. It helped reinforce my understanding of hardware-software integration and real-time programming.

Resources

pm/prj2025/eradu/andrei.gheta.txt · Last modified: 2025/05/29 19:32 by andrei.gheta
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0