# billforsternz/tarrasch-chess-gui architecture

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

- Interactive diagram: https://gitdiagram.com/billforsternz/tarrasch-chess-gui
- Repository: https://github.com/billforsternz/tarrasch-chess-gui

## Overview

Tarrasch is a desktop chess workbench for editing PGN games, playing or analyzing with UCI engines, and browsing chess databases. The principal workflow begins in the wxWidgets application, which coordinates game interaction and can hand positions to an engine; PGN and database facilities support importing, editing, and searching games. The graph also retains documented opening-book and training capabilities. Some subsystem links are based on README descriptions because their implementation files were not sampled; those links are dashed. This reflects the available excerpts, not a complete runtime trace.

Main entry points: [`src/main.cpp`](https://github.com/billforsternz/tarrasch-chess-gui/blob/master/src/main.cpp) (Application shell), [`src/GameLogic.cpp`](https://github.com/billforsternz/tarrasch-chess-gui/blob/master/src/GameLogic.cpp) (Game commands), [`src/GameDocument.cpp`](https://github.com/billforsternz/tarrasch-chess-gui/blob/master/src/GameDocument.cpp) (Game document), [`src/UciInterface.h`](https://github.com/billforsternz/tarrasch-chess-gui/blob/master/src/UciInterface.h) (UCI engine interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_application["Desktop application"]
  node_app["Application shell<br/>[main.cpp]"]
  node_board["Board and context<br/>[PanelBoard.cpp]"]
  node_repository[("Preferences<br/>[Repository.cpp]")]
end

subgraph group_games["Chess games"]
  node_game_logic["Game commands<br/>[GameLogic.cpp]"]
  node_game_document["Game document<br/>[GameDocument.cpp]"]
  node_game_view["Game display<br/>[GameView.cpp]"]
end

subgraph group_analysis["Analysis tools"]
  node_engine_dialog["Engine settings<br/>[EngineDialog.cpp]"]
  node_engine_control["UCI engine interface<br/>[UciInterface.h]"]
  node_engine_process{{"External chess engine"}}
  node_suspend_engine["Engine suspension<br/>[SuspendEngine.h]"]
  node_opening_book[("Opening book<br/>[Book.cpp]")]
  node_training["Training mode<br/>[TrainingDialog.cpp]"]
end

subgraph group_data["Game data"]
  node_pgn["PGN parsing<br/>[PgnRead.cpp]"]
  node_database[("Chess database<br/>[Database.cpp]")]
  node_database_create["Database creation"]
  node_position_search["Position search"]
  node_pattern_search["Pattern matching<br/>[PatternMatch.cpp]"]
end

node_user(("Chess player"))

node_user -->|"uses"| node_app
node_app -->|"dispatches"| node_game_logic
node_app -->|"creates"| node_board
node_app -->|"loads settings"| node_repository
node_game_logic -.->|"edits"| node_game_document
node_game_logic -.->|"updates"| node_game_view
node_user -.->|"edits PGN"| node_game_document
node_game_document -.->|"imports and exports"| node_pgn
node_app -->|"opens settings"| node_engine_dialog
node_engine_dialog -->|"suspends"| node_suspend_engine
node_suspend_engine -->|"controls"| node_engine_control
node_game_logic -.->|"analyzes positions"| node_engine_control
node_engine_control -.->|"communicates"| node_engine_process
node_app -->|"loads book"| node_opening_book
node_user -.->|"practices"| node_training
node_user -.->|"searches games"| node_database
node_database_create -->|"reads games"| node_pgn
node_database_create -->|"creates database"| node_database
node_user -.->|"searches positions"| node_position_search
node_user -.->|"searches patterns"| node_pattern_search

click node_app "https://github.com/billforsternz/tarrasch-chess-gui/blob/master/src/main.cpp"
click node_board "https://github.com/billforsternz/tarrasch-chess-gui/blob/master/src/PanelBoard.cpp"
click node_game_logic "https://github.com/billforsternz/tarrasch-chess-gui/blob/master/src/GameLogic.cpp"
click node_game_document "https://github.com/billforsternz/tarrasch-chess-gui/blob/master/src/GameDocument.cpp"
click node_game_view "https://github.com/billforsternz/tarrasch-chess-gui/blob/master/src/GameView.cpp"
click node_pgn "https://github.com/billforsternz/tarrasch-chess-gui/blob/master/src/PgnRead.cpp"
click node_database "https://github.com/billforsternz/tarrasch-chess-gui/blob/master/src/Database.cpp"
click node_database_create "https://github.com/billforsternz/tarrasch-chess-gui/blob/master/src/CreateDatabaseDialog.cpp"
click node_repository "https://github.com/billforsternz/tarrasch-chess-gui/blob/master/src/Repository.cpp"
click node_engine_dialog "https://github.com/billforsternz/tarrasch-chess-gui/blob/master/src/EngineDialog.cpp"
click node_engine_control "https://github.com/billforsternz/tarrasch-chess-gui/blob/master/src/UciInterface.h"
click node_suspend_engine "https://github.com/billforsternz/tarrasch-chess-gui/blob/master/src/SuspendEngine.h"
click node_opening_book "https://github.com/billforsternz/tarrasch-chess-gui/blob/master/src/Book.cpp"
click node_training "https://github.com/billforsternz/tarrasch-chess-gui/blob/master/src/TrainingDialog.cpp"
click node_position_search "https://github.com/billforsternz/tarrasch-chess-gui/blob/master/src/MemoryPositionSearch.cpp"
click node_pattern_search "https://github.com/billforsternz/tarrasch-chess-gui/blob/master/src/PatternMatch.cpp"

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_board,node_repository toneBlue
class node_game_logic,node_game_document,node_game_view toneAmber
class node_engine_dialog,node_engine_control,node_engine_process,node_suspend_engine,node_opening_book,node_training toneMint
class node_pgn,node_database,node_database_create,node_position_search,node_pattern_search toneRose
class node_user toneIndigo
```

## Components

### Desktop application

- [Application shell](https://github.com/billforsternz/tarrasch-chess-gui/blob/master/src/main.cpp): `src/main.cpp`
- [Board and context](https://github.com/billforsternz/tarrasch-chess-gui/blob/master/src/PanelBoard.cpp): `src/PanelBoard.cpp`
- [Preferences](https://github.com/billforsternz/tarrasch-chess-gui/blob/master/src/Repository.cpp): `src/Repository.cpp`

### Chess games

- [Game commands](https://github.com/billforsternz/tarrasch-chess-gui/blob/master/src/GameLogic.cpp): `src/GameLogic.cpp`
- [Game document](https://github.com/billforsternz/tarrasch-chess-gui/blob/master/src/GameDocument.cpp): `src/GameDocument.cpp`
- [Game display](https://github.com/billforsternz/tarrasch-chess-gui/blob/master/src/GameView.cpp): `src/GameView.cpp`

### Analysis tools

- [Engine settings](https://github.com/billforsternz/tarrasch-chess-gui/blob/master/src/EngineDialog.cpp): `src/EngineDialog.cpp`
- [UCI engine interface](https://github.com/billforsternz/tarrasch-chess-gui/blob/master/src/UciInterface.h): `src/UciInterface.h`
- **External chess engine**
- [Engine suspension](https://github.com/billforsternz/tarrasch-chess-gui/blob/master/src/SuspendEngine.h): `src/SuspendEngine.h`
- [Opening book](https://github.com/billforsternz/tarrasch-chess-gui/blob/master/src/Book.cpp): `src/Book.cpp`
- [Training mode](https://github.com/billforsternz/tarrasch-chess-gui/blob/master/src/TrainingDialog.cpp): `src/TrainingDialog.cpp`

### Game data

- [PGN parsing](https://github.com/billforsternz/tarrasch-chess-gui/blob/master/src/PgnRead.cpp): `src/PgnRead.cpp`
- [Chess database](https://github.com/billforsternz/tarrasch-chess-gui/blob/master/src/Database.cpp): `src/Database.cpp`
- [Database creation](https://github.com/billforsternz/tarrasch-chess-gui/blob/master/src/CreateDatabaseDialog.cpp): `src/CreateDatabaseDialog.cpp`
- [Position search](https://github.com/billforsternz/tarrasch-chess-gui/blob/master/src/MemoryPositionSearch.cpp): `src/MemoryPositionSearch.cpp`
- [Pattern matching](https://github.com/billforsternz/tarrasch-chess-gui/blob/master/src/PatternMatch.cpp): `src/PatternMatch.cpp`

### Other components

- **Chess player**

## Connections

- Chess player → Application shell: uses
- Application shell → Game commands: dispatches (evidence: `src/main.cpp`)
- Application shell → Board and context: creates (evidence: `src/main.cpp`)
- Application shell → Preferences: loads settings (evidence: `src/main.cpp`)
- Game commands → Game document: edits
- Game commands → Game display: updates
- Chess player → Game document: edits PGN
- Game document → PGN parsing: imports and exports
- Application shell → Engine settings: opens settings (evidence: `src/main.cpp`)
- Engine settings → Engine suspension: suspends
- Engine suspension → UCI engine interface: controls (evidence: `src/SuspendEngine.h`)
- Game commands → UCI engine interface: analyzes positions
- UCI engine interface → External chess engine: communicates
- Application shell → Opening book: loads book (evidence: `src/main.cpp`)
- Chess player → Training mode: practices
- Chess player → Chess database: searches games
- Database creation → PGN parsing: reads games (evidence: `src/CreateDatabaseDialog.cpp`)
- Database creation → Chess database: creates database (evidence: `src/CreateDatabaseDialog.cpp`)
- Chess player → Position search: searches positions
- Chess player → Pattern matching: searches patterns
