# ahmedalkhwalde/cubic_lands architecture

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

- Interactive diagram: https://gitdiagram.com/ahmedalkhwalde/cubic_lands
- Repository: https://github.com/ahmedalkhwalde/cubic_lands

## Overview

This is a Java grid puzzle solver: Main defines a level and starts A*; the search asks GameController for legal successor states, movement logic applies rules to copied boards, and the search prints a goal path or failure. The model tracks cube position/color, visited cells, and color-count goals. The excerpts also show DFS, BFS, uniform-cost, hill-climbing, and interactive play capabilities. No README is present, so coverage and relationships reflect the supplied source excerpts and index.

Main entry points: [`src/controller/GameController.java`](https://github.com/ahmedalkhwalde/cubic_lands/blob/main/src/controller/GameController.java) (Game controller), [`src/controller/MoveOnController.java`](https://github.com/ahmedalkhwalde/cubic_lands/blob/main/src/controller/MoveOnController.java) (Move execution), [`src/level/Level.java`](https://github.com/ahmedalkhwalde/cubic_lands/blob/main/src/level/Level.java) (Level loader), [`src/models/Board.java`](https://github.com/ahmedalkhwalde/cubic_lands/blob/main/src/models/Board.java) (Board state)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry and play"]
  node_main["Level setup<br/>[Main.java]"]
  node_game["Game controller"]
end

subgraph group_search["Path search"]
  node_algorithm["Search algorithms<br/>[Algorithim.java]"]
end

subgraph group_movement["Move rules"]
  node_move["Move execution"]
  node_check["Move validation"]
end

subgraph group_domain["Puzzle state"]
  node_level["Level loader<br/>[Level.java]"]
  node_state["Game state<br/>[GameState.java]"]
  node_board["Board state<br/>[Board.java]"]
  node_cell["Grid cells<br/>[Cell.java]"]
  node_cube["Player cube<br/>[Cube.java]"]
end

node_user(("Console user"))

node_main -->|"creates level"| node_level
node_main -->|"initializes game"| node_game
node_main -->|"starts A*"| node_algorithm
node_game -->|"loads board"| node_level
node_game -->|"creates moves"| node_move
node_algorithm -->|"requests successors"| node_game
node_game -->|"generates successors"| node_move
node_move -->|"checks movement"| node_check
node_move -->|"updates board"| node_board
node_move -->|"creates successor"| node_state
node_check -->|"reads geometry"| node_board
node_level -->|"constructs board"| node_board
node_level -->|"constructs cells"| node_cell
node_level -->|"constructs cube"| node_cube
node_board -->|"stores grid"| node_cell
node_board -->|"stores cube"| node_cube
node_user -.->|"enters moves"| node_game

click node_main "https://github.com/ahmedalkhwalde/cubic_lands/blob/main/src/Main.java"
click node_game "https://github.com/ahmedalkhwalde/cubic_lands/blob/main/src/controller/GameController.java"
click node_algorithm "https://github.com/ahmedalkhwalde/cubic_lands/blob/main/src/Logic/Algorithim.java"
click node_move "https://github.com/ahmedalkhwalde/cubic_lands/blob/main/src/controller/MoveOnController.java"
click node_check "https://github.com/ahmedalkhwalde/cubic_lands/blob/main/src/controller/MoveChekcontroller.java"
click node_level "https://github.com/ahmedalkhwalde/cubic_lands/blob/main/src/level/Level.java"
click node_state "https://github.com/ahmedalkhwalde/cubic_lands/blob/main/src/level/GameState.java"
click node_board "https://github.com/ahmedalkhwalde/cubic_lands/blob/main/src/models/Board.java"
click node_cell "https://github.com/ahmedalkhwalde/cubic_lands/blob/main/src/models/Cell.java"
click node_cube "https://github.com/ahmedalkhwalde/cubic_lands/blob/main/src/models/Cube.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_main,node_game,node_user toneBlue
class node_algorithm toneAmber
class node_move,node_check toneMint
class node_level,node_state,node_board,node_cell,node_cube toneRose
```

## Components

### Entry and play

- [Level setup](https://github.com/ahmedalkhwalde/cubic_lands/blob/main/src/Main.java): `src/Main.java`
- [Game controller](https://github.com/ahmedalkhwalde/cubic_lands/blob/main/src/controller/GameController.java): `src/controller/GameController.java`

### Path search

- [Search algorithms](https://github.com/ahmedalkhwalde/cubic_lands/blob/main/src/Logic/Algorithim.java): `src/Logic/Algorithim.java`

### Move rules

- [Move execution](https://github.com/ahmedalkhwalde/cubic_lands/blob/main/src/controller/MoveOnController.java): `src/controller/MoveOnController.java`
- [Move validation](https://github.com/ahmedalkhwalde/cubic_lands/blob/main/src/controller/MoveChekcontroller.java): `src/controller/MoveChekcontroller.java`

### Puzzle state

- [Level loader](https://github.com/ahmedalkhwalde/cubic_lands/blob/main/src/level/Level.java): `src/level/Level.java`
- [Game state](https://github.com/ahmedalkhwalde/cubic_lands/blob/main/src/level/GameState.java): `src/level/GameState.java`
- [Board state](https://github.com/ahmedalkhwalde/cubic_lands/blob/main/src/models/Board.java): `src/models/Board.java`
- [Grid cells](https://github.com/ahmedalkhwalde/cubic_lands/blob/main/src/models/Cell.java): `src/models/Cell.java`
- [Player cube](https://github.com/ahmedalkhwalde/cubic_lands/blob/main/src/models/Cube.java): `src/models/Cube.java`

### Other components

- **Console user**

## Connections

- Level setup → Level loader: creates level (evidence: `src/Main.java`)
- Level setup → Game controller: initializes game (evidence: `src/Main.java`)
- Level setup → Search algorithms: starts A* (evidence: `src/Main.java`)
- Game controller → Level loader: loads board (evidence: `src/controller/GameController.java`)
- Game controller → Move execution: creates moves (evidence: `src/controller/GameController.java`)
- Search algorithms → Game controller: requests successors (evidence: `src/Logic/Algorithim.java`)
- Game controller → Move execution: generates successors (evidence: `src/controller/GameController.java`)
- Move execution → Move validation: checks movement (evidence: `src/controller/MoveOnController.java`)
- Move execution → Board state: updates board (evidence: `src/controller/MoveOnController.java`)
- Move execution → Game state: creates successor (evidence: `src/controller/MoveOnController.java`)
- Move validation → Board state: reads geometry (evidence: `src/controller/MoveChekcontroller.java`)
- Level loader → Board state: constructs board (evidence: `src/level/Level.java`)
- Level loader → Grid cells: constructs cells (evidence: `src/level/Level.java`)
- Level loader → Player cube: constructs cube (evidence: `src/level/Level.java`)
- Board state → Grid cells: stores grid (evidence: `src/models/Board.java`)
- Board state → Player cube: stores cube (evidence: `src/models/Board.java`)
- Console user → Game controller: enters moves
