# alizajn/rescue-mission-207 architecture

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

- Interactive diagram: https://gitdiagram.com/alizajn/rescue-mission-207
- Repository: https://github.com/alizajn/rescue-mission-207

## Overview

##### Main Components
- Command Center Component: Represented by the central Explorer class in the team’s package (ca.mcmaster.se2aa4.island.team207.Explorer) and the Runner class that integrates with the game arena.
- Decision Modules: The various decision classes (e.g., Stop, FindLand, FlyingToLand, ScanLeft, ScanRight, TurnLeft, TurnRight) which encapsulate the logic for exploration, are grouped under the “Decisions” subpackage.
- Points of Interest (POIs): The POIs package with classes such as CreekResults, Creeks, GetPOIs, etc., handles the discovery and processing of key elements in the map.
- Power Management: The “Power” subpackage (containing Battery, Budget, and Cost) which is likely used to manage energy or resource constraints.
- Auxiliary Components: Other supporting classes like Direction, Position, and Result that facilitate movement, track location, and capture outcomes.
- External Artifacts:
- Maps Directory: Contains input JSON files for the game’s maps.
- Outputs Directory: Where the resulting POIs JSON, transcript JSON, and Explorer.svg are generated.
- Build & Configuration: Maven (pom.xml) for project management, log4j2 configuration (log4j2.xml), and GitHub workflows indicate CI integration.

##### Relationships and Interactions
- The Runner class serves as the entry point, taking a map file from the maps directory as input, initiating the Explorer.
- The Explorer coordinates with various decision classes to determine the exploration strategy (here, stopping immediately for safety).
- The decision modules are used to decide “what action” to perform at a particular game state, while classes in the POIs package work to calculate and record special points in the game (like creeks or sites).
- Power management classes (Battery, Budget, Cost) may interact with the decision process to ensure that constraints (e.g., fuel consumption or energy budget) are respected.
- Output generation: As the Runner executes the game loop, different outputs are generated, representing the state and progress of the exploration.

##### Architectural Patterns & Design Principles
- Modular design: The system is built in layers where different concerns are separated (decision logic, POIs discovery, power management).
- Single Responsibility and Separation of Concerns: Each package/component focuses on a specific aspect of the game logic (navigation, analysis, or configuration).
- Command Pattern (implicit): The different decision classes can be seen as commands that encapsulate the actions to be executed.

##### Relevant Technologies, Frameworks, and Tools
- Java with a Maven build system for dependency management and packaging.
- Log4j2 for logging (indicated by the configuration in resources).
- GitHub Actions (CI/CD configuration in .github/workflows) for automated builds.
- JSON handling for map input and output files.

- Link it to the “Runner” that provides the map input and to the “Decisions” module which branches out into various action classes.
- Explorer’s decisions to the “POIs” and “Power Management” modules to capture environment feedback.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Input Layer"
        Maps["Maps (Input)"]:::external
    end

    subgraph "Command Center"
        Runner["Runner"]:::command
        Explorer["Explorer (Command Center)"]:::command
    end

    subgraph "Decision Modules"
        Decisions["Decisions (Strategy Commands)"]:::decision
    end

    subgraph "Processing Modules"
        POIs["POIs (Points of Interest)"]:::poi
        Power["Power Management"]:::power
    end

    subgraph "Auxiliary Components"
        Direction["Direction"]:::auxiliary
        Position["Position"]:::auxiliary
        Result["Result"]:::auxiliary
    end

    subgraph "Outputs"
        Outputs["Outputs (Results)"]:::external
    end

    subgraph "Infrastructure"
        Maven["Maven (pom.xml)"]:::infra
        Log4j2["Log4j2 (log4j2.xml)"]:::infra
        GitHub["GitHub Workflows"]:::infra
    end

    %% Arrows for data flow and interactions
    Maps -->|"provides_map"| Runner
    Runner -->|"initiates"| Explorer
    Explorer -->|"executes"| Decisions
    Explorer -->|"generates_output"| Outputs
    Decisions -->|"determines_POIs"| POIs
    Decisions -->|"checks_power"| Power
    Explorer -->|"utilizes"| Direction
    Explorer -->|"utilizes"| Position
    Explorer -->|"utilizes"| Result

    %% Infrastructure influences
    Maven -.->|"builds"| Runner
    Log4j2 -.->|"logs"| Explorer
    GitHub -.->|"CI/CD"| Runner

    %% Styling definitions
    classDef command fill:#f9c74f,stroke:#000,stroke-width:2px;
    classDef decision fill:#90be6d,stroke:#000,stroke-width:2px;
    classDef poi fill:#f94144,stroke:#000,stroke-width:2px;
    classDef power fill:#577590,stroke:#fff,stroke-width:2px;
    classDef auxiliary fill:#f3722c,stroke:#000,stroke-width:2px;
    classDef external fill:#80ed99,stroke:#000,stroke-width:2px;
    classDef infra fill:#f8961e,stroke:#000,stroke-width:2px;

    %% Click Events
    click Explorer "https://github.com/alizajn/rescue-mission-207/blob/main/src/main/java/ca/mcmaster/se2aa4/island/team207/Explorer.java"
    click Runner "https://github.com/alizajn/rescue-mission-207/blob/main/src/main/java/ca/mcmaster/se2aa4/island/team207/Runner.java"
    click Decisions "https://github.com/alizajn/rescue-mission-207/tree/main/src/main/java/ca/mcmaster/se2aa4/island/team207/Decisions"
    click POIs "https://github.com/alizajn/rescue-mission-207/tree/main/src/main/java/ca/mcmaster/se2aa4/island/team207/POIs"
    click Power "https://github.com/alizajn/rescue-mission-207/tree/main/src/main/java/ca/mcmaster/se2aa4/island/team207/Power"
    click Direction "https://github.com/alizajn/rescue-mission-207/blob/main/src/main/java/ca/mcmaster/se2aa4/island/team207/Direction.java"
    click Position "https://github.com/alizajn/rescue-mission-207/blob/main/src/main/java/ca/mcmaster/se2aa4/island/team207/Position.java"
    click Result "https://github.com/alizajn/rescue-mission-207/blob/main/src/main/java/ca/mcmaster/se2aa4/island/team207/Result.java"
    click Maven "https://github.com/alizajn/rescue-mission-207/blob/main/pom.xml"
    click Log4j2 "https://github.com/alizajn/rescue-mission-207/blob/main/src/main/resources/log4j2.xml"
    click GitHub "https://github.com/alizajn/rescue-mission-207/blob/main/.github/workflows/build.yaml"
    click Maps "https://github.com/alizajn/rescue-mission-207/tree/main/maps"
    click Outputs "https://github.com/alizajn/rescue-mission-207/tree/main/outputs"
```
