How lortizrios/piedra-papel-y-tijera works
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)