# othello-hackhive/othello architecture

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

- Interactive diagram: https://gitdiagram.com/othello-hackhive/othello
- Repository: https://github.com/othello-hackhive/othello

## Overview

Othello solves the Cable Ring Challenge: it reads a floor plan, assigns eligible rooms and nodes to the fewest hubs, builds closed axis-aligned cable rings through openings, independently checks the design, and emits official JSON plus overlay data. The tree also contains a browser-based ResPlan optimizer and visualization. The README establishes the end-to-end product stages; source-index references support many internal links, but unsampled backend entry-point wiring is not asserted beyond documented relationships.

Main entry points: [`src/othello/checker/validate.py`](https://github.com/othello-hackhive/othello/blob/main/src/othello/checker/validate.py) (Independent checker), [`src/othello/solver/outer.py`](https://github.com/othello-hackhive/othello/blob/main/src/othello/solver/outer.py) (Hub-count search), [`src/othello/io/official.py`](https://github.com/othello-hackhive/othello/blob/main/src/othello/io/official.py) (Official JSON), [`frontend/src/App.tsx`](https://github.com/othello-hackhive/othello/blob/main/frontend/src/App.tsx) (Optimization UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Browser optimizer"]
  node_app["Optimization UI<br/>[App.tsx]"]
  node_parse["ResPlan parser<br/>[resplan.ts]"]
  node_webopt["Browser optimizer<br/>[optimizer.ts]"]
  node_scene["Twin scene<br/>[TwinScene.tsx]"]
end

subgraph group_input["Plan and configuration"]
  node_reader["Plan reader<br/>[load_plan.py]"]
  node_stats["Plan statistics<br/>[stats.py]"]
  node_settings["Solver settings<br/>[settings.py]"]
  node_models["Domain contracts<br/>[plan.py]"]
  node_config["Rules and limits<br/>[config.py]"]
end

subgraph group_solver["Design search"]
  node_outer["Hub-count search<br/>[outer.py]"]
  node_partition["Room partitions<br/>[partitions.py]"]
  node_candidates["Hub candidates<br/>[hub_candidates.py]"]
  node_orders["Node orders<br/>[node_orders.py]"]
  node_selection["Route selection<br/>[route_selection.py]"]
  node_improve["Design improvement<br/>[improvement.py]"]
end

subgraph group_routing["Geometry and routing"]
  node_grid["Rectilinear graph<br/>[grid.py]"]
  node_astar["A* routing<br/>[astar.py]"]
  node_routes["Route library<br/>[route_library.py]"]
end

subgraph group_output["Validation and output"]
  node_checker["Independent checker<br/>[validate.py]"]
  node_geometry["Geometry checks<br/>[geometry.py]"]
  node_metrics["Score metrics<br/>[metrics.py]"]
  node_result["Validation result<br/>[result.py]"]
  node_official["Official JSON<br/>[official.py]"]
  node_overlay["Overlay output<br/>[overlay.py]"]
end

node_user(("Plan operator"))

node_user -->|"uploads plan"| node_app
node_app -->|"loads plan"| node_parse
node_app -->|"runs optimizer"| node_webopt
node_webopt -->|"uses parser"| node_parse
node_app -->|"renders scene"| node_scene
node_user -->|"provides floor plan"| node_reader
node_reader -->|"creates plan"| node_models
node_reader -->|"supports statistics"| node_stats
node_settings -->|"loads configuration"| node_config
node_outer -->|"considers assignments"| node_partition
node_outer -->|"requests candidates"| node_candidates
node_outer -->|"requests orders"| node_orders
node_outer -->|"selects routes"| node_selection
node_improve -->|"reuses candidates"| node_candidates
node_improve -->|"reuses orders"| node_orders
node_improve -->|"searches alternatives"| node_selection
node_orders -->|"routes estimates"| node_astar
node_selection -->|"builds route options"| node_routes
node_routes -->|"uses routing graph"| node_grid
node_routes -->|"searches paths"| node_astar
node_grid -->|"reads plan geometry"| node_models
node_checker -->|"checks geometry"| node_geometry
node_checker -->|"computes score"| node_metrics
node_checker -->|"returns validation"| node_result
node_outer -.->|"verifies design"| node_checker
node_selection -.->|"checks candidates"| node_checker
node_official -->|"validates output"| node_checker
node_official -->|"serializes design"| node_models
node_overlay -->|"uses official data"| node_official
node_overlay -->|"adds score data"| node_metrics
node_checker -.->|"supplies verified design"| node_official
node_official -->|"writes official JSON"| node_user
node_overlay -->|"writes overlay"| node_user

click node_app "https://github.com/othello-hackhive/othello/blob/main/frontend/src/App.tsx"
click node_parse "https://github.com/othello-hackhive/othello/blob/main/frontend/src/lib/resplan.ts"
click node_webopt "https://github.com/othello-hackhive/othello/blob/main/frontend/src/lib/optimizer.ts"
click node_scene "https://github.com/othello-hackhive/othello/blob/main/frontend/src/components/TwinScene.tsx"
click node_reader "https://github.com/othello-hackhive/othello/blob/main/src/othello/reader/load_plan.py"
click node_stats "https://github.com/othello-hackhive/othello/blob/main/src/othello/reader/stats.py"
click node_settings "https://github.com/othello-hackhive/othello/blob/main/src/othello/io/settings.py"
click node_models "https://github.com/othello-hackhive/othello/blob/main/src/othello/models/plan.py"
click node_config "https://github.com/othello-hackhive/othello/blob/main/src/othello/models/config.py"
click node_outer "https://github.com/othello-hackhive/othello/blob/main/src/othello/solver/outer.py"
click node_partition "https://github.com/othello-hackhive/othello/blob/main/src/othello/territory/partitions.py"
click node_candidates "https://github.com/othello-hackhive/othello/blob/main/src/othello/solver/hub_candidates.py"
click node_orders "https://github.com/othello-hackhive/othello/blob/main/src/othello/solver/node_orders.py"
click node_selection "https://github.com/othello-hackhive/othello/blob/main/src/othello/solver/route_selection.py"
click node_improve "https://github.com/othello-hackhive/othello/blob/main/src/othello/solver/improvement.py"
click node_grid "https://github.com/othello-hackhive/othello/blob/main/src/othello/routing/grid.py"
click node_astar "https://github.com/othello-hackhive/othello/blob/main/src/othello/routing/astar.py"
click node_routes "https://github.com/othello-hackhive/othello/blob/main/src/othello/routing/route_library.py"
click node_checker "https://github.com/othello-hackhive/othello/blob/main/src/othello/checker/validate.py"
click node_geometry "https://github.com/othello-hackhive/othello/blob/main/src/othello/checker/geometry.py"
click node_metrics "https://github.com/othello-hackhive/othello/blob/main/src/othello/checker/metrics.py"
click node_result "https://github.com/othello-hackhive/othello/blob/main/src/othello/models/result.py"
click node_official "https://github.com/othello-hackhive/othello/blob/main/src/othello/io/official.py"
click node_overlay "https://github.com/othello-hackhive/othello/blob/main/src/othello/io/overlay.py"

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_app,node_parse,node_webopt,node_scene toneBlue
class node_reader,node_stats,node_settings,node_models,node_config toneAmber
class node_outer,node_partition,node_candidates,node_orders,node_selection,node_improve toneMint
class node_grid,node_astar,node_routes toneRose
class node_checker,node_geometry,node_metrics,node_result,node_official,node_overlay,node_user toneIndigo
```

## Components

### Browser optimizer

- [Optimization UI](https://github.com/othello-hackhive/othello/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [ResPlan parser](https://github.com/othello-hackhive/othello/blob/main/frontend/src/lib/resplan.ts): `frontend/src/lib/resplan.ts`
- [Browser optimizer](https://github.com/othello-hackhive/othello/blob/main/frontend/src/lib/optimizer.ts): `frontend/src/lib/optimizer.ts`
- [Twin scene](https://github.com/othello-hackhive/othello/blob/main/frontend/src/components/TwinScene.tsx): `frontend/src/components/TwinScene.tsx`

### Plan and configuration

- [Plan reader](https://github.com/othello-hackhive/othello/blob/main/src/othello/reader/load_plan.py): `src/othello/reader/load_plan.py`
- [Plan statistics](https://github.com/othello-hackhive/othello/blob/main/src/othello/reader/stats.py): `src/othello/reader/stats.py`
- [Solver settings](https://github.com/othello-hackhive/othello/blob/main/src/othello/io/settings.py): `src/othello/io/settings.py`
- [Domain contracts](https://github.com/othello-hackhive/othello/blob/main/src/othello/models/plan.py): `src/othello/models/plan.py`
- [Rules and limits](https://github.com/othello-hackhive/othello/blob/main/src/othello/models/config.py): `src/othello/models/config.py`

### Design search

- [Hub-count search](https://github.com/othello-hackhive/othello/blob/main/src/othello/solver/outer.py): `src/othello/solver/outer.py`
- [Room partitions](https://github.com/othello-hackhive/othello/blob/main/src/othello/territory/partitions.py): `src/othello/territory/partitions.py`
- [Hub candidates](https://github.com/othello-hackhive/othello/blob/main/src/othello/solver/hub_candidates.py): `src/othello/solver/hub_candidates.py`
- [Node orders](https://github.com/othello-hackhive/othello/blob/main/src/othello/solver/node_orders.py): `src/othello/solver/node_orders.py`
- [Route selection](https://github.com/othello-hackhive/othello/blob/main/src/othello/solver/route_selection.py): `src/othello/solver/route_selection.py`
- [Design improvement](https://github.com/othello-hackhive/othello/blob/main/src/othello/solver/improvement.py): `src/othello/solver/improvement.py`

### Geometry and routing

- [Rectilinear graph](https://github.com/othello-hackhive/othello/blob/main/src/othello/routing/grid.py): `src/othello/routing/grid.py`
- [A* routing](https://github.com/othello-hackhive/othello/blob/main/src/othello/routing/astar.py): `src/othello/routing/astar.py`
- [Route library](https://github.com/othello-hackhive/othello/blob/main/src/othello/routing/route_library.py): `src/othello/routing/route_library.py`

### Validation and output

- [Independent checker](https://github.com/othello-hackhive/othello/blob/main/src/othello/checker/validate.py): `src/othello/checker/validate.py`
- [Geometry checks](https://github.com/othello-hackhive/othello/blob/main/src/othello/checker/geometry.py): `src/othello/checker/geometry.py`
- [Score metrics](https://github.com/othello-hackhive/othello/blob/main/src/othello/checker/metrics.py): `src/othello/checker/metrics.py`
- [Validation result](https://github.com/othello-hackhive/othello/blob/main/src/othello/models/result.py): `src/othello/models/result.py`
- [Official JSON](https://github.com/othello-hackhive/othello/blob/main/src/othello/io/official.py): `src/othello/io/official.py`
- [Overlay output](https://github.com/othello-hackhive/othello/blob/main/src/othello/io/overlay.py): `src/othello/io/overlay.py`

### Other components

- **Plan operator**

## Connections

- Plan operator → Optimization UI: uploads plan (evidence: `frontend/src/App.tsx`)
- Optimization UI → ResPlan parser: loads plan (evidence: `frontend/src/App.tsx`)
- Optimization UI → Browser optimizer: runs optimizer (evidence: `frontend/src/App.tsx`)
- Browser optimizer → ResPlan parser: uses parser (evidence: `frontend/src/lib/optimizer.ts`)
- Optimization UI → Twin scene: renders scene (evidence: `frontend/src/App.tsx`)
- Plan operator → Plan reader: provides floor plan
- Plan reader → Domain contracts: creates plan (evidence: `src/othello/reader/load_plan.py`)
- Plan reader → Plan statistics: supports statistics (evidence: `src/othello/reader/stats.py`)
- Solver settings → Rules and limits: loads configuration (evidence: `src/othello/io/settings.py`)
- Hub-count search → Room partitions: considers assignments (evidence: `src/othello/solver/outer.py`)
- Hub-count search → Hub candidates: requests candidates (evidence: `src/othello/solver/outer.py`)
- Hub-count search → Node orders: requests orders (evidence: `src/othello/solver/outer.py`)
- Hub-count search → Route selection: selects routes (evidence: `src/othello/solver/outer.py`)
- Design improvement → Hub candidates: reuses candidates (evidence: `src/othello/solver/improvement.py`)
- Design improvement → Node orders: reuses orders (evidence: `src/othello/solver/improvement.py`)
- Design improvement → Route selection: searches alternatives (evidence: `src/othello/solver/improvement.py`)
- Node orders → A* routing: routes estimates (evidence: `src/othello/solver/node_orders.py`)
- Route selection → Route library: builds route options (evidence: `src/othello/solver/route_selection.py`)
- Route library → Rectilinear graph: uses routing graph (evidence: `src/othello/routing/route_library.py`)
- Route library → A* routing: searches paths (evidence: `src/othello/routing/route_library.py`)
- Rectilinear graph → Domain contracts: reads plan geometry (evidence: `src/othello/routing/grid.py`)
- Independent checker → Geometry checks: checks geometry (evidence: `src/othello/checker/validate.py`)
- Independent checker → Score metrics: computes score (evidence: `src/othello/checker/validate.py`)
- Independent checker → Validation result: returns validation (evidence: `src/othello/checker/validate.py`)
- Hub-count search → Independent checker: verifies design
- Route selection → Independent checker: checks candidates
- Official JSON → Independent checker: validates output (evidence: `src/othello/io/official.py`)
- Official JSON → Domain contracts: serializes design (evidence: `src/othello/io/official.py`)
- Overlay output → Official JSON: uses official data (evidence: `src/othello/io/overlay.py`)
- Overlay output → Score metrics: adds score data (evidence: `src/othello/io/overlay.py`)
- Independent checker → Official JSON: supplies verified design (evidence: `src/othello/io/official.py`)
- Official JSON → Plan operator: writes official JSON
- Overlay output → Plan operator: writes overlay
