# rockkamal253-ns/wizards_chess architecture

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

- Interactive diagram: https://gitdiagram.com/rockkamal253-ns/wizards_chess
- Repository: https://github.com/rockkamal253-ns/wizards_chess

## Overview

Wizard’s Chess is a desktop 3D chess game: a player interacts with the Three.js board, game controls update the match, and the integrated Python chess engine supplies AI play. The frontend separates input and match presentation from rendering, while shared state coordinates them. The README documents the desktop wrapper, Three.js, and Python engine; the source index supports the frontend module relationships shown here. The exact bridge from browser-side AI requests to Python is not visible in the excerpts, so that connection is marked unverified.

Main entry points: [`web/main.js`](https://github.com/rockkamal253-ns/wizards_chess/blob/main/web/main.js) (Application runtime), [`web/hud.js`](https://github.com/rockkamal253-ns/wizards_chess/blob/main/web/hud.js) (Match controls and HUD), [`web/input.js`](https://github.com/rockkamal253-ns/wizards_chess/blob/main/web/input.js) (Move input and AI), [`web/board.js`](https://github.com/rockkamal253-ns/wizards_chess/blob/main/web/board.js) (Board and markers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop runtime"]
  node_desktop_app["Desktop launcher<br/>[app.py]"]
  node_web_entry["Game interface<br/>[index.html]"]
  node_main["Application runtime<br/>[main.js]"]
end

subgraph group_match["Match and controls"]
  node_ai_engine["Chess AI<br/>[engine.py]"]
  node_input["Move input and AI<br/>[input.js]"]
  node_hud["Match controls and HUD<br/>[hud.js]"]
end

subgraph group_scene["3D presentation"]
  node_board["Board and markers<br/>[board.js]"]
  node_pieces["Procedural pieces<br/>[pieces.js]"]
  node_cathedral["Cathedral environment<br/>[cathedral.js]"]
  node_materials["Renderer and materials<br/>[materials.js]"]
  node_textures["Procedural textures<br/>[textures.js]"]
  node_camera["Camera controls<br/>[camera.js]"]
end

subgraph group_shared["Shared services"]
  node_game_state["Game state<br/>[state.js]"]
  node_dom["DOM access<br/>[dom.js]"]
  node_settings["Settings persistence<br/>[settings.js]"]
  node_toast["Notifications<br/>[toast.js]"]
  node_audio["Synthesized audio<br/>[audio.js]"]
end

node_player(("Player"))

node_player -->|"opens game"| node_web_entry
node_desktop_app -.->|"hosts interface"| node_web_entry
node_desktop_app -->|"integrates AI"| node_ai_engine
node_web_entry -.->|"starts runtime"| node_main
node_main -->|"uses state"| node_game_state
node_main -->|"uses DOM"| node_dom
node_main -->|"initializes renderer"| node_materials
node_main -->|"builds environment"| node_cathedral
node_main -->|"initializes board"| node_board
node_main -->|"builds pieces"| node_pieces
node_main -->|"initializes input"| node_input
node_main -->|"updates HUD"| node_hud
node_main -->|"initializes camera"| node_camera
node_main -->|"loads settings"| node_settings
node_input -->|"reads and updates"| node_game_state
node_input -->|"updates markers"| node_board
node_input -->|"updates display"| node_hud
node_input -->|"shows messages"| node_toast
node_input -.->|"requests AI move"| node_ai_engine
node_hud -->|"reads and updates"| node_game_state
node_hud -->|"syncs board"| node_board
node_hud -->|"triggers AI"| node_input
node_hud -->|"shows messages"| node_toast
node_hud -->|"controls audio"| node_audio
node_hud -->|"saves settings"| node_settings
node_board -->|"reads board state"| node_game_state
node_board -->|"creates meshes"| node_pieces
node_board -->|"uses materials"| node_materials
node_board -->|"plays capture sound"| node_audio
node_pieces -->|"uses materials"| node_materials
node_cathedral -->|"uses materials"| node_materials
node_materials -->|"creates textures"| node_textures
node_camera -->|"reads view state"| node_game_state
node_camera -->|"uses controls"| node_dom
node_camera -->|"updates view UI"| node_hud
node_camera -->|"coordinates input"| node_input
node_settings -->|"persists preferences"| node_game_state
node_settings -->|"restores mute state"| node_audio
node_settings -->|"updates controls"| node_dom
node_toast -->|"uses container"| node_dom

click node_desktop_app "https://github.com/rockkamal253-ns/wizards_chess/blob/main/app.py"
click node_web_entry "https://github.com/rockkamal253-ns/wizards_chess/blob/main/web/index.html"
click node_ai_engine "https://github.com/rockkamal253-ns/wizards_chess/blob/main/engine.py"
click node_input "https://github.com/rockkamal253-ns/wizards_chess/blob/main/web/input.js"
click node_hud "https://github.com/rockkamal253-ns/wizards_chess/blob/main/web/hud.js"
click node_game_state "https://github.com/rockkamal253-ns/wizards_chess/blob/main/web/state.js"
click node_dom "https://github.com/rockkamal253-ns/wizards_chess/blob/main/web/dom.js"
click node_settings "https://github.com/rockkamal253-ns/wizards_chess/blob/main/web/settings.js"
click node_toast "https://github.com/rockkamal253-ns/wizards_chess/blob/main/web/toast.js"
click node_audio "https://github.com/rockkamal253-ns/wizards_chess/blob/main/web/audio.js"
click node_main "https://github.com/rockkamal253-ns/wizards_chess/blob/main/web/main.js"
click node_board "https://github.com/rockkamal253-ns/wizards_chess/blob/main/web/board.js"
click node_pieces "https://github.com/rockkamal253-ns/wizards_chess/blob/main/web/pieces.js"
click node_cathedral "https://github.com/rockkamal253-ns/wizards_chess/blob/main/web/cathedral.js"
click node_materials "https://github.com/rockkamal253-ns/wizards_chess/blob/main/web/materials.js"
click node_textures "https://github.com/rockkamal253-ns/wizards_chess/blob/main/web/textures.js"
click node_camera "https://github.com/rockkamal253-ns/wizards_chess/blob/main/web/camera.js"

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_desktop_app,node_web_entry,node_main toneBlue
class node_ai_engine,node_input,node_hud toneAmber
class node_board,node_pieces,node_cathedral,node_materials,node_textures,node_camera toneMint
class node_game_state,node_dom,node_settings,node_toast,node_audio toneRose
class node_player toneIndigo
```

## Components

### Desktop runtime

- [Desktop launcher](https://github.com/rockkamal253-ns/wizards_chess/blob/main/app.py): `app.py`
- [Game interface](https://github.com/rockkamal253-ns/wizards_chess/blob/main/web/index.html): `web/index.html`
- [Application runtime](https://github.com/rockkamal253-ns/wizards_chess/blob/main/web/main.js): `web/main.js`

### Match and controls

- [Chess AI](https://github.com/rockkamal253-ns/wizards_chess/blob/main/engine.py): `engine.py`
- [Move input and AI](https://github.com/rockkamal253-ns/wizards_chess/blob/main/web/input.js): `web/input.js`
- [Match controls and HUD](https://github.com/rockkamal253-ns/wizards_chess/blob/main/web/hud.js): `web/hud.js`

### 3D presentation

- [Board and markers](https://github.com/rockkamal253-ns/wizards_chess/blob/main/web/board.js): `web/board.js`
- [Procedural pieces](https://github.com/rockkamal253-ns/wizards_chess/blob/main/web/pieces.js): `web/pieces.js`
- [Cathedral environment](https://github.com/rockkamal253-ns/wizards_chess/blob/main/web/cathedral.js): `web/cathedral.js`
- [Renderer and materials](https://github.com/rockkamal253-ns/wizards_chess/blob/main/web/materials.js): `web/materials.js`
- [Procedural textures](https://github.com/rockkamal253-ns/wizards_chess/blob/main/web/textures.js): `web/textures.js`
- [Camera controls](https://github.com/rockkamal253-ns/wizards_chess/blob/main/web/camera.js): `web/camera.js`

### Shared services

- [Game state](https://github.com/rockkamal253-ns/wizards_chess/blob/main/web/state.js): `web/state.js`
- [DOM access](https://github.com/rockkamal253-ns/wizards_chess/blob/main/web/dom.js): `web/dom.js`
- [Settings persistence](https://github.com/rockkamal253-ns/wizards_chess/blob/main/web/settings.js): `web/settings.js`
- [Notifications](https://github.com/rockkamal253-ns/wizards_chess/blob/main/web/toast.js): `web/toast.js`
- [Synthesized audio](https://github.com/rockkamal253-ns/wizards_chess/blob/main/web/audio.js): `web/audio.js`

### Other components

- **Player**

## Connections

- Player → Game interface: opens game (evidence: `README.md`)
- Desktop launcher → Game interface: hosts interface (evidence: `README.md`)
- Desktop launcher → Chess AI: integrates AI (evidence: `README.md`)
- Game interface → Application runtime: starts runtime
- Application runtime → Game state: uses state (evidence: `web/main.js`)
- Application runtime → DOM access: uses DOM (evidence: `web/main.js`)
- Application runtime → Renderer and materials: initializes renderer (evidence: `web/main.js`)
- Application runtime → Cathedral environment: builds environment (evidence: `web/main.js`)
- Application runtime → Board and markers: initializes board (evidence: `web/main.js`)
- Application runtime → Procedural pieces: builds pieces (evidence: `web/main.js`)
- Application runtime → Move input and AI: initializes input (evidence: `web/main.js`)
- Application runtime → Match controls and HUD: updates HUD (evidence: `web/main.js`)
- Application runtime → Camera controls: initializes camera (evidence: `web/main.js`)
- Application runtime → Settings persistence: loads settings (evidence: `web/main.js`)
- Move input and AI → Game state: reads and updates (evidence: `web/input.js`)
- Move input and AI → Board and markers: updates markers (evidence: `web/input.js`)
- Move input and AI → Match controls and HUD: updates display (evidence: `web/input.js`)
- Move input and AI → Notifications: shows messages (evidence: `web/input.js`)
- Move input and AI → Chess AI: requests AI move
- Match controls and HUD → Game state: reads and updates (evidence: `web/hud.js`)
- Match controls and HUD → Board and markers: syncs board (evidence: `web/hud.js`)
- Match controls and HUD → Move input and AI: triggers AI (evidence: `web/hud.js`)
- Match controls and HUD → Notifications: shows messages (evidence: `web/hud.js`)
- Match controls and HUD → Synthesized audio: controls audio (evidence: `web/hud.js`)
- Match controls and HUD → Settings persistence: saves settings (evidence: `web/hud.js`)
- Board and markers → Game state: reads board state (evidence: `web/board.js`)
- Board and markers → Procedural pieces: creates meshes (evidence: `web/board.js`)
- Board and markers → Renderer and materials: uses materials (evidence: `web/board.js`)
- Board and markers → Synthesized audio: plays capture sound (evidence: `web/board.js`)
- Procedural pieces → Renderer and materials: uses materials (evidence: `web/pieces.js`)
- Cathedral environment → Renderer and materials: uses materials (evidence: `web/cathedral.js`)
- Renderer and materials → Procedural textures: creates textures (evidence: `web/materials.js`)
- Camera controls → Game state: reads view state (evidence: `web/camera.js`)
- Camera controls → DOM access: uses controls (evidence: `web/camera.js`)
- Camera controls → Match controls and HUD: updates view UI (evidence: `web/camera.js`)
- Camera controls → Move input and AI: coordinates input (evidence: `web/camera.js`)
- Settings persistence → Game state: persists preferences (evidence: `web/settings.js`)
- Settings persistence → Synthesized audio: restores mute state (evidence: `web/settings.js`)
- Settings persistence → DOM access: updates controls (evidence: `web/settings.js`)
- Notifications → DOM access: uses container (evidence: `web/toast.js`)
