# oosubhisara/java-pathfinding architecture

> Architecture diagram of the GitHub repository oosubhisara/java-pathfinding, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/oosubhisara/java-pathfinding
- Repository: https://github.com/oosubhisara/java-pathfinding

## Overview

This JavaFX application lets a user edit a tile map, mark start and target cells, find a route, and animate movement along it; maps can also be opened and saved. The sampled code shows the app loading the scene, coordinating the controller and grid, and invoking BFS before starting a timed walk. The grid owns tile state, rendering, and map-file I/O. The tree and README identify JavaFX as the UI, but the FXML wiring was not sampled, so UI-to-controller event links are omitted.

Main entry points: [`src/main/java/com/oosubhisara/walker/PathFindingApp.java`](https://github.com/oosubhisara/java-pathfinding/blob/main/src/main/java/com/oosubhisara/walker/PathFindingApp.java) (Pathfinding app), [`src/main/java/com/oosubhisara/walker/Grid.java`](https://github.com/oosubhisara/java-pathfinding/blob/main/src/main/java/com/oosubhisara/walker/Grid.java) (Tile grid), [`src/main/java/com/oosubhisara/walker/Controller.java`](https://github.com/oosubhisara/java-pathfinding/blob/main/src/main/java/com/oosubhisara/walker/Controller.java) (UI controller), [`src/main/java/com/oosubhisara/algorithm/Bfs.java`](https://github.com/oosubhisara/java-pathfinding/blob/main/src/main/java/com/oosubhisara/algorithm/Bfs.java) (Breadth-first search)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["JavaFX interface"]
  node_scene["Main scene<br/>[MainScene.fxml]"]
end

subgraph group_control["Application control"]
  node_app["Pathfinding app"]
  node_controller["UI controller<br/>[Controller.java]"]
  node_walk["Timed path walk"]
end

subgraph group_world["Map and search"]
  node_grid["Tile grid<br/>[Grid.java]"]
  node_bfs["Breadth-first search<br/>[Bfs.java]"]
end

subgraph group_runtime["Launch and state"]
  node_launcher["Launcher<br/>[Launcher.java]"]
  node_global["Controller reference<br/>[Global.java]"]
end

node_user(("Map editor user"))
node_mapfiles["Map files"]

node_user -.->|"edits map"| node_controller
node_launcher -->|"launches"| node_app
node_app -->|"loads scene"| node_scene
node_controller -->|"requests actions"| node_app
node_controller -->|"registers itself"| node_global
node_app -->|"sets controller"| node_controller
node_app -->|"creates and configures"| node_grid
node_controller -->|"edits and refreshes"| node_grid
node_app -->|"loads and saves"| node_grid
node_grid -->|"reads and writes"| node_mapfiles
node_grid -->|"builds search nodes"| node_bfs
node_app -->|"finds route"| node_bfs
node_app -->|"starts animation"| node_walk
node_walk -->|"updates and draws"| node_grid

click node_launcher "https://github.com/oosubhisara/java-pathfinding/blob/main/src/main/java/com/oosubhisara/walker/Launcher.java"
click node_app "https://github.com/oosubhisara/java-pathfinding/blob/main/src/main/java/com/oosubhisara/walker/PathFindingApp.java"
click node_controller "https://github.com/oosubhisara/java-pathfinding/blob/main/src/main/java/com/oosubhisara/walker/Controller.java"
click node_global "https://github.com/oosubhisara/java-pathfinding/blob/main/src/main/java/com/oosubhisara/walker/Global.java"
click node_scene "https://github.com/oosubhisara/java-pathfinding/blob/main/src/main/resources/com/oosubhisara/walker/MainScene.fxml"
click node_grid "https://github.com/oosubhisara/java-pathfinding/blob/main/src/main/java/com/oosubhisara/walker/Grid.java"
click node_bfs "https://github.com/oosubhisara/java-pathfinding/blob/main/src/main/java/com/oosubhisara/algorithm/Bfs.java"
click node_walk "https://github.com/oosubhisara/java-pathfinding/blob/main/src/main/java/com/oosubhisara/walker/PathFindingApp.java"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_scene,node_user toneBlue
class node_app,node_controller,node_walk toneAmber
class node_grid,node_bfs toneMint
class node_launcher,node_global toneRose
class node_mapfiles toneIndigo
```

## Components

### JavaFX interface

- [Main scene](https://github.com/oosubhisara/java-pathfinding/blob/main/src/main/resources/com/oosubhisara/walker/MainScene.fxml): `src/main/resources/com/oosubhisara/walker/MainScene.fxml`

### Application control

- [Pathfinding app](https://github.com/oosubhisara/java-pathfinding/blob/main/src/main/java/com/oosubhisara/walker/PathFindingApp.java): `src/main/java/com/oosubhisara/walker/PathFindingApp.java`
- [UI controller](https://github.com/oosubhisara/java-pathfinding/blob/main/src/main/java/com/oosubhisara/walker/Controller.java): `src/main/java/com/oosubhisara/walker/Controller.java`
- [Timed path walk](https://github.com/oosubhisara/java-pathfinding/blob/main/src/main/java/com/oosubhisara/walker/PathFindingApp.java): `src/main/java/com/oosubhisara/walker/PathFindingApp.java`

### Map and search

- [Tile grid](https://github.com/oosubhisara/java-pathfinding/blob/main/src/main/java/com/oosubhisara/walker/Grid.java): `src/main/java/com/oosubhisara/walker/Grid.java`
- [Breadth-first search](https://github.com/oosubhisara/java-pathfinding/blob/main/src/main/java/com/oosubhisara/algorithm/Bfs.java): `src/main/java/com/oosubhisara/algorithm/Bfs.java`

### Launch and state

- [Launcher](https://github.com/oosubhisara/java-pathfinding/blob/main/src/main/java/com/oosubhisara/walker/Launcher.java): `src/main/java/com/oosubhisara/walker/Launcher.java`
- [Controller reference](https://github.com/oosubhisara/java-pathfinding/blob/main/src/main/java/com/oosubhisara/walker/Global.java): `src/main/java/com/oosubhisara/walker/Global.java`

### Other components

- **Map editor user**
- **Map files**

## Connections

- Map editor user → UI controller: edits map
- Launcher → Pathfinding app: launches (evidence: `src/main/java/com/oosubhisara/walker/Launcher.java`)
- Pathfinding app → Main scene: loads scene (evidence: `src/main/java/com/oosubhisara/walker/PathFindingApp.java`)
- UI controller → Pathfinding app: requests actions (evidence: `src/main/java/com/oosubhisara/walker/Controller.java`)
- UI controller → Controller reference: registers itself (evidence: `src/main/java/com/oosubhisara/walker/Controller.java`)
- Pathfinding app → UI controller: sets controller (evidence: `src/main/java/com/oosubhisara/walker/PathFindingApp.java`)
- Pathfinding app → Tile grid: creates and configures (evidence: `src/main/java/com/oosubhisara/walker/PathFindingApp.java`)
- UI controller → Tile grid: edits and refreshes (evidence: `src/main/java/com/oosubhisara/walker/Controller.java`)
- Pathfinding app → Tile grid: loads and saves (evidence: `src/main/java/com/oosubhisara/walker/PathFindingApp.java`)
- Tile grid → Map files: reads and writes (evidence: `src/main/java/com/oosubhisara/walker/Grid.java`)
- Tile grid → Breadth-first search: builds search nodes (evidence: `src/main/java/com/oosubhisara/walker/Grid.java`)
- Pathfinding app → Breadth-first search: finds route (evidence: `src/main/java/com/oosubhisara/walker/PathFindingApp.java`)
- Pathfinding app → Timed path walk: starts animation (evidence: `src/main/java/com/oosubhisara/walker/Controller.java`)
- Timed path walk → Tile grid: updates and draws (evidence: `src/main/java/com/oosubhisara/walker/PathFindingApp.java`)
