# felipe-cerv/jarras-busqueda-ciega architecture

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

- Interactive diagram: https://gitdiagram.com/felipe-cerv/jarras-busqueda-ciega
- Repository: https://github.com/felipe-cerv/jarras-busqueda-ciega

## Overview

##### Main Components
- Core Search Module:
- Component: BusquedaCiega (located at IA/BusquedaCiega.py)
- Role: Implements the blind search algorithm (specifically breadth-first search) to navigate through different states of the jugs.
- Action Module:
- Component: Acciones (directory with Acciones.py and __init__.py)
- Role: Defines the actions that can be applied to the current state of the jugs. It contains a function that receives a list (representing the current state) and randomly selects an action, returning a new state after applying the action.
- State Representation:
- Although not explicitly present as a separate module, the state of the jugs is an implicit component, and it is what ties together the actions with the search algorithm.

##### Relationships and Interactions
- BusquedaCiega is the orchestrator that uses the functions provided by the Acciones module to generate successor states.
- The search algorithm repeatedly applies a random action (selected by the Acciones module) to the current state.
- There is a cyclical relationship: the search module takes a state, passes it to the actions module, receives an updated state, and then evaluates whether the solution is reached, continuing the process accordingly.

##### Important Architectural Patterns
- Separation of Concerns: Clear segregation between the algorithm (BusquedaCiega) and the state mutation logic (Acciones).
- Modularity: Each module has a distinct role. This is especially beneficial if further enhancements (e.g., adding other search algorithms or refining the actions) are needed.
- Randomized Action Selection: Although the basic algorithm is non-deterministic (i.e., random action selection), it adheres to the structure needed for a breadth-first search in state-space exploration.

##### Relevant Technologies and Design Principles
- Python as the core programming language.
- Fundamental design principles such as modular programming and separation of concerns.
- If later extended, additional libraries (for visualization or logging) could be integrated without changing the basic architectural layout.

##### Specific Elements
- Each main component should be clearly labeled (e.g., “BusquedaCiega Module”, “Acciones Module”, “State Representation”).
- BusquedaCiega → Acciones: indicating that the search algorithm calls the actions function.
- Acciones → BusquedaCiega: showing the feedback loop where a new state is returned to the search algorithm.
- Optionally, include a “State Space” node that represents the evolving configurations of the jugs.

## Diagram (Mermaid)

```mermaid
flowchart TD
    Main["Main Process"]:::main
    BusquedaCiega["BusquedaCiega Module"]:::module
    Acciones["Acciones Module"]:::module
    State["State Representation"]:::state

    Main -->|"initiate_search"| BusquedaCiega
    BusquedaCiega -->|"apply_action"| Acciones
    Acciones -->|"return_new_state"| BusquedaCiega
    BusquedaCiega -->|"update_state"| State

    %% Click Events
    click BusquedaCiega "https://github.com/felipe-cerv/jarras-busqueda-ciega/blob/main/IA/BusquedaCiega.py"
    click Acciones "https://github.com/felipe-cerv/jarras-busqueda-ciega/tree/main/IA/Acciones"

    %% Styles
    classDef main fill:#fdd,stroke:#900,stroke-width:2px;
    classDef module fill:#ddf,stroke:#009,stroke-width:2px;
    classDef state fill:#dfd,stroke:#090,stroke-width:2px;
```
