# aneprados/reto_algoritmos architecture

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

- Interactive diagram: https://gitdiagram.com/aneprados/reto_algoritmos
- Repository: https://github.com/aneprados/reto_algoritmos

## Overview

##### Main Components
- Main Application – Represented by files such as main.py and menu.py. This part of the system likely handles user input and overall program flow.
- Algorithmic Modules – There are two primary modules: one for the “Caballos” (knight/chess knight problem) and one for “Reinas” (queen or related problem). Each contains its own set of classes (e.g., Caballo.py, Nodo.py, Pobrador.py in the Caballos directory and Nodo.py, Observar.py, reina.py in the Reinas directory).
- Internal Classes and Utilities – Within each module, there are supporting classes (like “Nodo” and “lanzador”) that manage state representations and algorithm execution (likely implementing techniques such as backtracking and memoization that are mentioned in the README).

##### Relationships and Interactions
- The Main Application (main.py/menu.py) acts as the central hub. It likely provides the user interface for selecting which algorithmic module to run.
- Once a selection is made, the appropriate module’s “lanzador” file (launcher) is invoked, which then utilizes other classes in that directory (e.g., Caballo, Nodo, Pobrador for the knight problem) to perform computations.
- Within each algorithm module, classes interact for tasks such as building state trees (using Nodo), executing moves (Caballo or reina), and managing algorithm-specific utility functions (e.g., in Pobrador or Observar).

##### Architectural Patterns or Design Principles
- Separation of Concerns – The project cleanly separates distinct algorithm implementations into separate modules, which keeps each challenge encapsulated.
- Reusability and Modularity – By placing each challenge in its own directory with clearly designated roles (launcher, algorithm core classes), the design emphasizes modularity.

##### Relevant Technologies or Frameworks
- Python – Clearly the primary language.
- Visualization (Optional) – The README mentions a dependency on pygame, so if visualization is part of any of these modules, include it as an auxiliary component that interfaces with the main algorithm or UI.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Main Application"
        main_py["main.py"]:::ui
        menu_py["menu.py"]:::ui
    end

    %% Main Application triggering modules
    menu_py -->|"selects_Caballos"| caballos_lanzador["Caballos: lanzador"]:::caballos
    menu_py -->|"selects_Reinas"| reinas_lanzador["Reinas: lanzador"]:::reinas

    subgraph "Caballos Module"
        caballos_lanzador["Caballos: lanzador"]:::caballos
        caballos_Caballo["Caballo"]:::caballos
        caballos_Nodo["Nodo (State)"]:::caballos
        caballos_Pobrador["Pobrador (Utility)"]:::caballos
    end

    %% Caballos Module internal flow
    caballos_lanzador -->|"calls"| caballos_Caballo
    caballos_lanzador -->|"calls"| caballos_Nodo
    caballos_lanzador -->|"calls"| caballos_Pobrador

    subgraph "Reinas Module"
        reinas_lanzador["Reinas: lanzador"]:::reinas
        reinas_Nodo["Nodo (State)"]:::reinas
        reinas_Observar["Observar (Utility)"]:::reinas
        reinas_reina["reina (Queen Core)"]:::reinas
    end

    %% Reinas Module internal flow
    reinas_lanzador -->|"calls"| reinas_Nodo
    reinas_lanzador -->|"calls"| reinas_Observar
    reinas_lanzador -->|"calls"| reinas_reina

    %% Click Events
    click main_py "https://github.com/aneprados/reto_algoritmos/blob/main/main.py"
    click menu_py "https://github.com/aneprados/reto_algoritmos/blob/main/menu.py"
    click caballos_Caballo "https://github.com/aneprados/reto_algoritmos/blob/main/Caballos/Caballo.py"
    click caballos_Nodo "https://github.com/aneprados/reto_algoritmos/blob/main/Caballos/Nodo.py"
    click caballos_Pobrador "https://github.com/aneprados/reto_algoritmos/blob/main/Caballos/Pobrador.py"
    click caballos_lanzador "https://github.com/aneprados/reto_algoritmos/blob/main/Caballos/lanzador.py"
    click reinas_Nodo "https://github.com/aneprados/reto_algoritmos/blob/main/Reinas/Nodo.py"
    click reinas_Observar "https://github.com/aneprados/reto_algoritmos/blob/main/Reinas/Observar.py"
    click reinas_reina "https://github.com/aneprados/reto_algoritmos/blob/main/Reinas/reina.py"
    click reinas_lanzador "https://github.com/aneprados/reto_algoritmos/blob/main/Reinas/lanzador.py"

    %% Styles
    classDef ui fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef caballos fill:#F9E79F,stroke:#000,stroke-width:2px;
    classDef reinas fill:#D6EAF8,stroke:#000,stroke-width:2px;
```
