# lortizrios/piedra-papel-y-tijera architecture

> Architecture diagram of the GitHub repository lortizrios/piedra-papel-y-tijera, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-08-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lortizrios/piedra-papel-y-tijera
- Repository: https://github.com/lortizrios/piedra-papel-y-tijera

## Overview

##### Project type and purpose
- This is a simple console‐based Rock–Paper–Scissors game written as a single Python script.
- Its goal is to prompt the user for input (rock, paper, or scissors), generate a computer choice, determine the winner, display results, and optionally repeat.

##### File structure
- Top level:
- Juego Piedra Papel y Tijera.py – contains the entire application logic in one file
- LICENSE
- README.md – brief description
- There are no subdirectories, frameworks, or external config files.

##### Review README for insights
- Confirms it is a console game (no GUI, no persistent storage).

##### Main components
a. User Interface (Console I/O)
– Reads user choice
– Displays prompts and results
b. Game Controller
– Coordinates game flow (start game, end game, replay)
c. Game Logic / Engine
– Encapsulates rules (rock beats scissors, etc.)
– Compares player choice vs. computer choice
d. Random Choice Generator
– Generates computer’s move (uses Python’s random module)
e. (Optional) Score Keeper
– Tracks win/lose/tie counts across rounds
f. (Optional) Validation Module
– Ensures user input is valid (rock, paper, or scissors)

##### Relationships and data flow
- User Interface → Game Controller (user choice)
- Game Controller → Validation Module → Game Controller
- Game Controller → Random Choice Generator → Game Logic
- Game Controller passes both choices to Game Logic
- Game Logic → Game Controller (winner/tie)
- Game Controller → Score Keeper → Game Controller
- Game Controller → User Interface (display result)

##### Architectural patterns and principles
- Single Responsibility: separate I/O, core logic, and randomness
- Modular design (even in one file, group functions or classes by concern)
- Clear flow of control (Game Controller as orchestrator)

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Juego Piedra Papel y Tijera.py"
        UI["Console I/O"]:::ui
        Controller["Game Controller"]:::core
        Logic["Game Logic"]:::core
        RandomGen["Random Generator"]:::util
        Validation["Validation Module"]:::util
        Score["Score Keeper"]:::core
    end

    UI -->|"user choice"| Controller
    Controller -->|"validate input"| Validation
    Validation -->|"valid/invalid"| Controller
    Controller -->|"generate move"| RandomGen
    Controller -->|"player vs computer"| Logic
    RandomGen -->|"computer choice"| Logic
    Logic -->|"result"| Controller
    Controller -.->|"track score (optional)"| Score
    Score -.->|"score data"| Controller
    Controller -->|"display result"| UI

    click UI "https://github.com/lortizrios/piedra-papel-y-tijera/blob/main/Juego Piedra Papel y Tijera.py"
    click Controller "https://github.com/lortizrios/piedra-papel-y-tijera/blob/main/Juego Piedra Papel y Tijera.py"
    click Logic "https://github.com/lortizrios/piedra-papel-y-tijera/blob/main/Juego Piedra Papel y Tijera.py"
    click RandomGen "https://github.com/lortizrios/piedra-papel-y-tijera/blob/main/Juego Piedra Papel y Tijera.py"
    click Validation "https://github.com/lortizrios/piedra-papel-y-tijera/blob/main/Juego Piedra Papel y Tijera.py"
    click Score "https://github.com/lortizrios/piedra-papel-y-tijera/blob/main/Juego Piedra Papel y Tijera.py"

    classDef ui fill:#D0E8FF,stroke:#0366D6,color:#0366D6;
    classDef core fill:#D5F5E3,stroke:#27AE60,color:#27AE60;
    classDef util fill:#FCF3CF,stroke:#F1C40F,color:#B7950B;
```
