# charlycrm/videojuegos_python architecture

> Architecture diagram of the GitHub repository charlycrm/videojuegos_python, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/charlycrm/videojuegos_python
- Repository: https://github.com/charlycrm/videojuegos_python

## Overview

##### Project type and purpose
- This is a small, stand-alone Python console game (“Hangman”).
- There is no client-server split, no database or external service—just a single script that runs in a terminal, handles user input, runs game logic, and prints output.

##### File structure
- Top-level files:
- README.md                → project description, rules, scoring
- ahorcado.py              → the entire game engine, input/output, word list, scoring logic
- No subdirectories, no configuration or build scripts, no dependencies other than the Python standard library.

##### README for additional insights
- Describes game flow: prompt user name, choose letters/words, keep track of attempts and score.
- Scoring rules and developer credit but no external integrations.

##### Main components
a. User Interface (Console I/O)
- Reads player name, letter/word guesses.
- Displays hangman drawing, hints, current score, win/lose messages.
b. Game Controller / Loop
- Initializes game state (word choice, attempts, score).
- Coordinates each turn: get input, validate, update state, check win/lose.
c. Word Provider
- The in-script list or file of possible words.
- Word selection logic (random choice).
d. Scoring Engine
- Applies scoring rules: +50 per correct letter occurrence, +50×length for full-word guess, –25 for incorrect guesses.
e. Hangman Renderer
- Builds the ASCII art stage based on remaining attempts.

##### Relationships and data flows
- User Interface → sends input to → Game Controller
- Game Controller ↔ queries → Word Provider (once at start) for the secret word
- Game Controller → invokes → Scoring Engine (each guess)
- Game Controller → passes remaining attempts to → Hangman Renderer → which outputs updated drawing back to UI
- Game Controller → directs UI to render updated score, hints, and prompts for next input

##### Architectural patterns and principles
- Single-threaded, synchronous I/O loop.
- Separation of concerns:
- Input/output
- Game logic / state management
- Word storage
- Scoring
- Presentation (ASCII art)

##### Elements to include for clarity
- Arrowheads for directionality.
- “Python 3.x” at the runtime boundary.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Python Runtime"
        UI["Console UI"]:::io
        Controller["Game Controller"]:::logic
        WordProvider["Word Provider"]:::data
        Scoring["Scoring Engine"]:::logic
        Renderer["Hangman Renderer"]:::presentation
    end

    UI -->|"guessInput"| Controller
    Controller -->|"getSecretWord"| WordProvider
    WordProvider -->|"secretWord"| Controller
    Controller -->|"evaluateGuess"| Scoring
    Scoring -->|"scoreUpdate"| Controller
    Controller -->|"remainingAttempts"| Renderer
    Renderer -->|"asciiStage"| UI
    Controller -->|"displayHints, score, prompts"| UI

    README["README.md"]:::external

    classDef io fill:#9ae6b4,stroke:#2f855a,color:#22543d
    classDef logic fill:#bee3f8,stroke:#2b6cb0,color:#2c5282
    classDef data fill:#fefcbf,stroke:#d69e2e,color:#975a16
    classDef presentation fill:#fed7d7,stroke:#c53030,color:#742a2a
    classDef external fill:#e2e8f0,stroke:#718096,color:#2d3748,stroke-dasharray: 5 5

    click UI "https://github.com/charlycrm/videojuegos_python/blob/main/ahorcado.py"
    click Controller "https://github.com/charlycrm/videojuegos_python/blob/main/ahorcado.py"
    click WordProvider "https://github.com/charlycrm/videojuegos_python/blob/main/ahorcado.py"
    click Scoring "https://github.com/charlycrm/videojuegos_python/blob/main/ahorcado.py"
    click Renderer "https://github.com/charlycrm/videojuegos_python/blob/main/ahorcado.py"
    click README "https://github.com/charlycrm/videojuegos_python/blob/main/README.md"
```
