# kahlaa-majid/chess--game architecture

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

- Interactive diagram: https://gitdiagram.com/kahlaa-majid/chess--game
- Repository: https://github.com/kahlaa-majid/chess--game

## Overview

This is a small, interactive chess program. The user enters coordinate-notation moves; the game loop parses and validates each move, checks king safety, updates the board and move history, and displays the position and any check. Move legality is split between piece-specific rules and attack detection. All behavior is in vm08.py; edges reflect calls visible in the excerpt.

Main entry points: [`vm08.py`](https://github.com/kahlaa-majid/chess--game/blob/main/vm08.py) (Game loop)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_user(("Player"))
node_game["Game loop<br/>[vm08.py]"]
node_board["Board state<br/>[vm08.py]"]
node_notation["Move parser<br/>[vm08.py]"]
node_dispatcher["Move dispatcher<br/>[vm08.py]"]
node_piece_rules["Piece rules<br/>[vm08.py]"]
node_path_target["Path and target<br/>[vm08.py]"]
node_king_safety["King safety<br/>[vm08.py]"]
node_terminal["Console output"]

node_user -->|"enters moves"| node_game
node_game -->|"creates and updates"| node_board
node_game -->|"parses input"| node_notation
node_game -->|"validates moves"| node_dispatcher
node_game -->|"checks kings"| node_king_safety
node_game -->|"prints board and messages"| node_terminal
node_dispatcher -->|"dispatches by piece"| node_piece_rules
node_piece_rules -->|"checks path and target"| node_path_target
node_king_safety -->|"tests attacks"| node_dispatcher

click node_game "https://github.com/kahlaa-majid/chess--game/blob/main/vm08.py"
click node_board "https://github.com/kahlaa-majid/chess--game/blob/main/vm08.py"
click node_notation "https://github.com/kahlaa-majid/chess--game/blob/main/vm08.py"
click node_dispatcher "https://github.com/kahlaa-majid/chess--game/blob/main/vm08.py"
click node_piece_rules "https://github.com/kahlaa-majid/chess--game/blob/main/vm08.py"
click node_path_target "https://github.com/kahlaa-majid/chess--game/blob/main/vm08.py"
click node_king_safety "https://github.com/kahlaa-majid/chess--game/blob/main/vm08.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_user,node_terminal toneIndigo
class node_game,node_board,node_notation,node_dispatcher,node_piece_rules,node_path_target,node_king_safety toneTeal
```

## Components

### Other components

- **Player**
- [Game loop](https://github.com/kahlaa-majid/chess--game/blob/main/vm08.py): `vm08.py`
- [Board state](https://github.com/kahlaa-majid/chess--game/blob/main/vm08.py): `vm08.py`
- [Move parser](https://github.com/kahlaa-majid/chess--game/blob/main/vm08.py): `vm08.py`
- [Move dispatcher](https://github.com/kahlaa-majid/chess--game/blob/main/vm08.py): `vm08.py`
- [Piece rules](https://github.com/kahlaa-majid/chess--game/blob/main/vm08.py): `vm08.py`
- [Path and target](https://github.com/kahlaa-majid/chess--game/blob/main/vm08.py): `vm08.py`
- [King safety](https://github.com/kahlaa-majid/chess--game/blob/main/vm08.py): `vm08.py`
- **Console output**

## Connections

- Player → Game loop: enters moves (evidence: `vm08.py`)
- Game loop → Board state: creates and updates (evidence: `vm08.py`)
- Game loop → Move parser: parses input (evidence: `vm08.py`)
- Game loop → Move dispatcher: validates moves (evidence: `vm08.py`)
- Game loop → King safety: checks kings (evidence: `vm08.py`)
- Game loop → Console output: prints board and messages (evidence: `vm08.py`)
- Move dispatcher → Piece rules: dispatches by piece (evidence: `vm08.py`)
- Piece rules → Path and target: checks path and target (evidence: `vm08.py`)
- King safety → Move dispatcher: tests attacks (evidence: `vm08.py`)
