# zidhanerlansunanda-png/n-queen_p1_22 architecture

> Architecture diagram of the GitHub repository zidhanerlansunanda-png/n-queen_p1_22, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/zidhanerlansunanda-png/n-queen_p1_22
- Repository: https://github.com/zidhanerlansunanda-png/n-queen_p1_22

## Overview

This is a local browser-based N-Queens solver tester and visualizer. Users configure a solver and one of four board cases, generate or edit board positions, run the solver in a Web Worker, inspect validation and performance results, and browse solutions or debug snapshots on a rendered board. The graph follows the documented workflow and major capabilities. Several execution and UI connections are supported by the source index or README rather than full excerpts; unsampled implementation details are not inferred.

Main entry points: [`Tester/UI/app.ts`](https://github.com/zidhanerlansunanda-png/n-queen_p1_22/blob/main/Tester/UI/app.ts) (App wiring), [`Tester/Execution/session.ts`](https://github.com/zidhanerlansunanda-png/n-queen_p1_22/blob/main/Tester/Execution/session.ts) (Run session), [`Tester/Execution/solver-worker.ts`](https://github.com/zidhanerlansunanda-png/n-queen_p1_22/blob/main/Tester/Execution/solver-worker.ts) (Solver worker), [`Tester/Execution/protocol.ts`](https://github.com/zidhanerlansunanda-png/n-queen_p1_22/blob/main/Tester/Execution/protocol.ts) (Run protocol)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["User interface"]
  node_app["App wiring<br/>[app.ts]"]
  node_config["Config panel<br/>[panels.ts]"]
  node_runui["Run controls<br/>[run-panel.ts]"]
end

subgraph group_board["Board and rules"]
  node_boardgen["Board generation<br/>[positions.ts]"]
  node_preplaced["Preplaced queens<br/>[preplaced.ts]"]
  node_terrain["Case and terrain<br/>[terrain.ts]"]
  node_validator["Board validator<br/>[validator.ts]"]
end

subgraph group_execution["Solver execution"]
  node_solver["C++ solvers"]
  node_contract["Solver contract<br/>[nqueens.h]"]
  node_runtime["WASM harness<br/>[nqueen_runtime.cpp]"]
  node_controller["Run controller<br/>[run-controller.ts]"]
  node_session["Run session<br/>[session.ts]"]
  node_worker["Solver worker<br/>[solver-worker.ts]"]
  node_protocol["Run protocol<br/>[protocol.ts]"]
  node_reference["Reference solver<br/>[reference-run.ts]"]
end

subgraph group_results["Results and visualization"]
  node_judge["Result judging<br/>[judge.ts]"]
  node_check["Solution checking<br/>[solution-check.ts]"]
  node_sets["Solution storage<br/>[solution-set.ts]"]
  node_measure["Time and memory<br/>[measure.ts]"]
  node_snapshots["Snapshot store<br/>[snapshot-store.ts]"]
  node_browser["Result browsing<br/>[board-browser.ts]"]
  node_renderer["Board renderer<br/>[renderer.ts]"]
end

node_user(("Engineer"))

node_user -->|"uses"| node_app
node_app -->|"shows"| node_config
node_config -->|"parses positions"| node_boardgen
node_app -->|"generates positions"| node_boardgen
node_app -->|"generates queens"| node_preplaced
node_app -->|"configures runs"| node_controller
node_app -->|"prepares reference"| node_reference
node_app -->|"shows controls"| node_runui
node_runui -->|"controls runs"| node_controller
node_controller -->|"starts session"| node_session
node_session -->|"runs worker"| node_worker
node_worker -->|"exchanges messages"| node_protocol
node_session -->|"exchanges messages"| node_protocol
node_worker -->|"measures runs"| node_measure
node_worker -.->|"loads solver"| node_runtime
node_runtime -->|"implements interface"| node_contract
node_solver -->|"implements cases"| node_contract
node_session -->|"judges result"| node_judge
node_judge -->|"checks solutions"| node_check
node_check -->|"reads solutions"| node_sets
node_check -->|"validates board"| node_validator
node_judge -->|"uses run contract"| node_protocol
node_protocol -->|"stores snapshots"| node_snapshots
node_app -->|"offers browsing"| node_browser
node_browser -.->|"renders board"| node_renderer
node_renderer -->|"draws terrain"| node_terrain
node_browser -->|"browses snapshots"| node_snapshots

click node_app "https://github.com/zidhanerlansunanda-png/n-queen_p1_22/blob/main/Tester/UI/app.ts"
click node_config "https://github.com/zidhanerlansunanda-png/n-queen_p1_22/blob/main/Tester/UI/panels.ts"
click node_runui "https://github.com/zidhanerlansunanda-png/n-queen_p1_22/blob/main/Tester/UI/run-panel.ts"
click node_boardgen "https://github.com/zidhanerlansunanda-png/n-queen_p1_22/blob/main/Tester/Board/positions.ts"
click node_preplaced "https://github.com/zidhanerlansunanda-png/n-queen_p1_22/blob/main/Tester/Board/preplaced.ts"
click node_terrain "https://github.com/zidhanerlansunanda-png/n-queen_p1_22/blob/main/Tester/Board/terrain.ts"
click node_solver "https://github.com/zidhanerlansunanda-png/n-queen_p1_22/tree/main/Solver/submission-team"
click node_contract "https://github.com/zidhanerlansunanda-png/n-queen_p1_22/blob/main/Tester/Harness/nqueens.h"
click node_runtime "https://github.com/zidhanerlansunanda-png/n-queen_p1_22/blob/main/Tester/Harness/nqueen_runtime.cpp"
click node_controller "https://github.com/zidhanerlansunanda-png/n-queen_p1_22/blob/main/Tester/Execution/run-controller.ts"
click node_session "https://github.com/zidhanerlansunanda-png/n-queen_p1_22/blob/main/Tester/Execution/session.ts"
click node_worker "https://github.com/zidhanerlansunanda-png/n-queen_p1_22/blob/main/Tester/Execution/solver-worker.ts"
click node_protocol "https://github.com/zidhanerlansunanda-png/n-queen_p1_22/blob/main/Tester/Execution/protocol.ts"
click node_judge "https://github.com/zidhanerlansunanda-png/n-queen_p1_22/blob/main/Tester/Execution/judge.ts"
click node_check "https://github.com/zidhanerlansunanda-png/n-queen_p1_22/blob/main/Tester/Board/solution-check.ts"
click node_sets "https://github.com/zidhanerlansunanda-png/n-queen_p1_22/blob/main/Tester/Board/solution-set.ts"
click node_measure "https://github.com/zidhanerlansunanda-png/n-queen_p1_22/blob/main/Tester/Execution/measure.ts"
click node_snapshots "https://github.com/zidhanerlansunanda-png/n-queen_p1_22/blob/main/Tester/Execution/snapshot-store.ts"
click node_browser "https://github.com/zidhanerlansunanda-png/n-queen_p1_22/blob/main/Tester/UI/board-browser.ts"
click node_renderer "https://github.com/zidhanerlansunanda-png/n-queen_p1_22/blob/main/Tester/Visualization/renderer.ts"
click node_validator "https://github.com/zidhanerlansunanda-png/n-queen_p1_22/blob/main/Tester/Board/validator.ts"
click node_reference "https://github.com/zidhanerlansunanda-png/n-queen_p1_22/blob/main/Tester/Execution/reference-run.ts"

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_config,node_runui toneBlue
class node_boardgen,node_preplaced,node_terrain,node_validator toneAmber
class node_solver,node_contract,node_runtime,node_controller,node_session,node_worker,node_protocol,node_reference toneMint
class node_judge,node_check,node_sets,node_measure,node_snapshots,node_browser,node_renderer toneRose
class node_user toneIndigo
```

## Components

### User interface

- [App wiring](https://github.com/zidhanerlansunanda-png/n-queen_p1_22/blob/main/Tester/UI/app.ts): `Tester/UI/app.ts`
- [Config panel](https://github.com/zidhanerlansunanda-png/n-queen_p1_22/blob/main/Tester/UI/panels.ts): `Tester/UI/panels.ts`
- [Run controls](https://github.com/zidhanerlansunanda-png/n-queen_p1_22/blob/main/Tester/UI/run-panel.ts): `Tester/UI/run-panel.ts`

### Board and rules

- [Board generation](https://github.com/zidhanerlansunanda-png/n-queen_p1_22/blob/main/Tester/Board/positions.ts): `Tester/Board/positions.ts`
- [Preplaced queens](https://github.com/zidhanerlansunanda-png/n-queen_p1_22/blob/main/Tester/Board/preplaced.ts): `Tester/Board/preplaced.ts`
- [Case and terrain](https://github.com/zidhanerlansunanda-png/n-queen_p1_22/blob/main/Tester/Board/terrain.ts): `Tester/Board/terrain.ts`
- [Board validator](https://github.com/zidhanerlansunanda-png/n-queen_p1_22/blob/main/Tester/Board/validator.ts): `Tester/Board/validator.ts`

### Solver execution

- [C++ solvers](https://github.com/zidhanerlansunanda-png/n-queen_p1_22/tree/main/Solver/submission-team): `Solver/submission-team`
- [Solver contract](https://github.com/zidhanerlansunanda-png/n-queen_p1_22/blob/main/Tester/Harness/nqueens.h): `Tester/Harness/nqueens.h`
- [WASM harness](https://github.com/zidhanerlansunanda-png/n-queen_p1_22/blob/main/Tester/Harness/nqueen_runtime.cpp): `Tester/Harness/nqueen_runtime.cpp`
- [Run controller](https://github.com/zidhanerlansunanda-png/n-queen_p1_22/blob/main/Tester/Execution/run-controller.ts): `Tester/Execution/run-controller.ts`
- [Run session](https://github.com/zidhanerlansunanda-png/n-queen_p1_22/blob/main/Tester/Execution/session.ts): `Tester/Execution/session.ts`
- [Solver worker](https://github.com/zidhanerlansunanda-png/n-queen_p1_22/blob/main/Tester/Execution/solver-worker.ts): `Tester/Execution/solver-worker.ts`
- [Run protocol](https://github.com/zidhanerlansunanda-png/n-queen_p1_22/blob/main/Tester/Execution/protocol.ts): `Tester/Execution/protocol.ts`
- [Reference solver](https://github.com/zidhanerlansunanda-png/n-queen_p1_22/blob/main/Tester/Execution/reference-run.ts): `Tester/Execution/reference-run.ts`

### Results and visualization

- [Result judging](https://github.com/zidhanerlansunanda-png/n-queen_p1_22/blob/main/Tester/Execution/judge.ts): `Tester/Execution/judge.ts`
- [Solution checking](https://github.com/zidhanerlansunanda-png/n-queen_p1_22/blob/main/Tester/Board/solution-check.ts): `Tester/Board/solution-check.ts`
- [Solution storage](https://github.com/zidhanerlansunanda-png/n-queen_p1_22/blob/main/Tester/Board/solution-set.ts): `Tester/Board/solution-set.ts`
- [Time and memory](https://github.com/zidhanerlansunanda-png/n-queen_p1_22/blob/main/Tester/Execution/measure.ts): `Tester/Execution/measure.ts`
- [Snapshot store](https://github.com/zidhanerlansunanda-png/n-queen_p1_22/blob/main/Tester/Execution/snapshot-store.ts): `Tester/Execution/snapshot-store.ts`
- [Result browsing](https://github.com/zidhanerlansunanda-png/n-queen_p1_22/blob/main/Tester/UI/board-browser.ts): `Tester/UI/board-browser.ts`
- [Board renderer](https://github.com/zidhanerlansunanda-png/n-queen_p1_22/blob/main/Tester/Visualization/renderer.ts): `Tester/Visualization/renderer.ts`

### Other components

- **Engineer**

## Connections

- Engineer → App wiring: uses (evidence: `README.md`)
- App wiring → Config panel: shows (evidence: `Tester/UI/app.ts`)
- Config panel → Board generation: parses positions (evidence: `Tester/UI/panels.ts`)
- App wiring → Board generation: generates positions (evidence: `Tester/UI/app.ts`)
- App wiring → Preplaced queens: generates queens (evidence: `Tester/UI/app.ts`)
- App wiring → Run controller: configures runs (evidence: `Tester/UI/app.ts`)
- App wiring → Reference solver: prepares reference (evidence: `Tester/UI/app.ts`)
- App wiring → Run controls: shows controls (evidence: `Tester/UI/app.ts`)
- Run controls → Run controller: controls runs (evidence: `Tester/UI/run-panel.ts`)
- Run controller → Run session: starts session (evidence: `Tester/Execution/run-controller.ts`)
- Run session → Solver worker: runs worker (evidence: `Tester/Execution/session.ts`)
- Solver worker → Run protocol: exchanges messages (evidence: `Tester/Execution/solver-worker.ts`)
- Run session → Run protocol: exchanges messages (evidence: `Tester/Execution/session.ts`)
- Solver worker → Time and memory: measures runs (evidence: `Tester/Execution/solver-worker.ts`)
- Solver worker → WASM harness: loads solver
- WASM harness → Solver contract: implements interface (evidence: `Tester/Harness/nqueen_runtime.cpp`)
- C++ solvers → Solver contract: implements cases (evidence: `Tester/Harness/nqueens.h`)
- Run session → Result judging: judges result (evidence: `Tester/Execution/session.ts`)
- Result judging → Solution checking: checks solutions (evidence: `Tester/Execution/judge.ts`)
- Solution checking → Solution storage: reads solutions (evidence: `Tester/Board/solution-check.ts`)
- Solution checking → Board validator: validates board (evidence: `Tester/Board/solution-check.ts`)
- Result judging → Run protocol: uses run contract (evidence: `Tester/Execution/judge.ts`)
- Run protocol → Snapshot store: stores snapshots (evidence: `Tester/Execution/protocol.ts`)
- App wiring → Result browsing: offers browsing (evidence: `Tester/UI/app.ts`)
- Result browsing → Board renderer: renders board
- Board renderer → Case and terrain: draws terrain (evidence: `Tester/Visualization/renderer.ts`)
- Result browsing → Snapshot store: browses snapshots
