# moreover22/tp2-algo3 architecture

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

- Interactive diagram: https://gitdiagram.com/moreover22/tp2-algo3
- Repository: https://github.com/moreover22/tp2-algo3

## Overview

##### Main Components

a) View Layer (GUI):
- Main components like JuegoView, TableroView, and ContenedorEntrada
- Connection to CSS resources and sound files

b) Controller Layer:
- Controller components that handle user interactions
- Connection between view and model layers
- Controllers like BotonEmpezarController and UsarHabilidadController

c) Model Layer:
- Core game logic components
- Main classes like AlgoChess, Tablero, and Jugador
- Piece hierarchy and their relationships

##### Architectural Patterns to Highlight

- The project follows a clear MVC (Model-View-Controller) pattern
- Piece hierarchy using inheritance relationships
- Demonstrate the Strategy pattern used for different piece behaviors
- Observer pattern for game state updates

- View        |
- (JavaFX + CSS)  |

- ↕

- Controllers   |

- ↕

- Model       |

##### Component Relationships

Model Layer Details:

- AlgoChess  |---->|    Tablero    |

- >|    Jugador    |

- Pieza     |

- ↑
- [Piece Hierarchy]

##### Important Elements

a) Core Game Components:
- Piece system (Pieza hierarchy)
- Board management (Tablero and Casillero)
- Player system (Jugador)
- Turn management (Turno)

b) Special Features:
- Battalion formation system
- Weapon and ability system
- Range-based combat system
- Sound system integration

##### Technical Details to Note

- Java 11 requirement for JavaFX
- Maven build system
- Resource management (images, sounds, CSS)
- Test coverage and CI/CD integration

##### Interaction Flows

Main game flow:
**User Input → Controller → Model Update → View Update → Sound/Visual Feedback**

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef view fill:#3498db,stroke:#2980b9,color:white
    classDef controller fill:#2ecc71,stroke:#27ae60,color:white
    classDef model fill:#e67e22,stroke:#d35400,color:white
    classDef resource fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef system fill:#9b59b6,stroke:#8e44ad,color:white

    %% View Layer
    subgraph ViewLayer
        JuegoView["JuegoView"]:::view
        TableroView["TableroView"]:::view
        ContenedorEntrada["ContenedorEntrada"]:::view
        Resources["Resources"]:::resource
    end

    %% Controller Layer
    subgraph ControllerLayer
        BotonEmpezar["BotonEmpezarController"]:::controller
        UsarHabilidad["UsarHabilidadController"]:::controller
        PiezaSeleccionar["PiezaSeleccionarController"]:::controller
    end

    %% Model Layer
    subgraph ModelLayer
        AlgoChess["AlgoChess"]:::model
        Turno["Turno"]:::model
        Tablero["Tablero"]:::model
        Jugador["Jugador"]:::model
        
        subgraph PieceSystem
            Pieza["Pieza"]:::model
            Batallon["Batallon"]:::model
            CreadorBatallon["CreadorBatallon"]:::model
        end
        
        subgraph Systems
            Movimiento["Movement System"]:::system
            Habilidad["Ability System"]:::system
            Rango["Range System"]:::system
        end
    end

    %% Relationships
    JuegoView --> BotonEmpezar
    JuegoView --> TableroView
    TableroView --> PiezaSeleccionar
    TableroView --> UsarHabilidad
    
    BotonEmpezar --> AlgoChess
    UsarHabilidad --> Habilidad
    PiezaSeleccionar --> Pieza
    
    AlgoChess --> Tablero
    AlgoChess --> Jugador
    AlgoChess --> Turno
    
    Jugador --> Pieza
    Pieza --> Batallon
    Pieza --> Movimiento
    Pieza --> Habilidad
    Pieza --> Rango
    
    Batallon --> CreadorBatallon

    %% Resource connections
    Resources --> JuegoView
    Resources --> TableroView

    %% Click events
    click JuegoView "https://github.com/moreover22/tp2-algo3/blob/master/src/main/java/fiuba/algo3/algochess/view/JuegoView.java"
    click TableroView "https://github.com/moreover22/tp2-algo3/blob/master/src/main/java/fiuba/algo3/algochess/view/tablero/TableroView.java"
    click ContenedorEntrada "https://github.com/moreover22/tp2-algo3/blob/master/src/main/java/fiuba/algo3/algochess/view/ContenedorEntrada.java"
    click Resources "https://github.com/moreover22/tp2-algo3/tree/master/src/main/resources"
    click BotonEmpezar "https://github.com/moreover22/tp2-algo3/blob/master/src/main/java/fiuba/algo3/algochess/controller/BotonEmpezarController.java"
    click UsarHabilidad "https://github.com/moreover22/tp2-algo3/blob/master/src/main/java/fiuba/algo3/algochess/controller/UsarHabilidadController.java"
    click PiezaSeleccionar "https://github.com/moreover22/tp2-algo3/blob/master/src/main/java/fiuba/algo3/algochess/controller/PiezaSeleccionarController.java"
    click AlgoChess "https://github.com/moreover22/tp2-algo3/blob/master/src/main/java/fiuba/algo3/algochess/model/AlgoChess.java"
    click Turno "https://github.com/moreover22/tp2-algo3/blob/master/src/main/java/fiuba/algo3/algochess/model/Turno.java"
    click Tablero "https://github.com/moreover22/tp2-algo3/blob/master/src/main/java/fiuba/algo3/algochess/model/tablero/Tablero.java"
    click Jugador "https://github.com/moreover22/tp2-algo3/blob/master/src/main/java/fiuba/algo3/algochess/model/jugador/Jugador.java"
    click Pieza "https://github.com/moreover22/tp2-algo3/blob/master/src/main/java/fiuba/algo3/algochess/model/pieza/Pieza.java"
    click Batallon "https://github.com/moreover22/tp2-algo3/blob/master/src/main/java/fiuba/algo3/algochess/model/pieza/Batallon.java"
    click CreadorBatallon "https://github.com/moreover22/tp2-algo3/blob/master/src/main/java/fiuba/algo3/algochess/model/pieza/CreadorBatallon.java"
    click Habilidad "https://github.com/moreover22/tp2-algo3/tree/master/src/main/java/fiuba/algo3/algochess/model/pieza/habilidad"
    click Movimiento "https://github.com/moreover22/tp2-algo3/blob/master/src/main/java/fiuba/algo3/algochess/model/pieza/movimiento/Movimiento.java"
    click Rango "https://github.com/moreover22/tp2-algo3/blob/master/src/main/java/fiuba/algo3/algochess/model/Rango.java"
```
