# lang010/cloudict architecture

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

- Interactive diagram: https://gitdiagram.com/lang010/cloudict
- Repository: https://github.com/lang010/cloudict

## Overview

Cloudict is a Connect6 engine with a command-driven play loop. A user sends board updates or requests a move; the engine updates game state, tries VCF tactical search when enabled, then falls back to alpha-beta search and returns a move. The search uses generated candidate moves and board evaluation; VCF uses pattern matching initialized from the documented patterns.in file. The excerpts show these main calls, but not the implementation details of situation.cc or vcf_search.cc, so those internals are represented conservatively.

Main entry points: [`src/game_engine.cc`](https://github.com/lang010/cloudict/blob/master/src/game_engine.cc) (Game Engine), [`src/vcf_search.cc`](https://github.com/lang010/cloudict/blob/master/src/vcf_search.cc) (VCF Search), [`src/search_engine.cc`](https://github.com/lang010/cloudict/blob/master/src/search_engine.cc) (Alpha-Beta Search), [`src/main.cc`](https://github.com/lang010/cloudict/blob/master/src/main.cc) (Program Entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Command Interface"]
  node_main["Program Entry<br/>[main.cc]"]
  node_engine["Game Engine<br/>[game_engine.cc]"]
end

subgraph group_game["Game State"]
  node_tools["Board and I/O Utilities<br/>[tools.cc]"]
  node_situation["Situation Logic<br/>[situation.cc]"]
  node_defines["Game Types and Constants<br/>[defines.h]"]
end

subgraph group_search["Move Search"]
  node_vcf["VCF Search<br/>[vcf_search.cc]"]
  node_alpha["Alpha-Beta Search<br/>[search_engine.cc]"]
end

subgraph group_analysis["Board Analysis"]
  node_generator["Move Generator<br/>[move_generator.cc]"]
  node_evaluation["Board Evaluation<br/>[evaluation.cc]"]
  node_patterns["Pattern DFA<br/>[pattern.cc]"]
end

node_user(("Game Client"))
node_patternfile["VCF Patterns<br/>[patterns.in]"]

node_user -->|"starts engine"| node_main
node_main -->|"initializes and runs"| node_engine
node_user -->|"sends commands"| node_engine
node_engine -->|"reads and updates board"| node_tools
node_engine -->|"tries tactical search"| node_vcf
node_engine -->|"runs fallback search"| node_alpha
node_alpha -->|"requests moves"| node_generator
node_alpha -->|"evaluates leaves"| node_evaluation
node_vcf -->|"uses DFA"| node_patterns
node_vcf -.->|"loads patterns"| node_patternfile
node_engine -->|"returns move"| node_user

click node_main "https://github.com/lang010/cloudict/blob/master/src/main.cc"
click node_engine "https://github.com/lang010/cloudict/blob/master/src/game_engine.cc"
click node_tools "https://github.com/lang010/cloudict/blob/master/src/tools.cc"
click node_situation "https://github.com/lang010/cloudict/blob/master/src/situation.cc"
click node_vcf "https://github.com/lang010/cloudict/blob/master/src/vcf_search.cc"
click node_alpha "https://github.com/lang010/cloudict/blob/master/src/search_engine.cc"
click node_generator "https://github.com/lang010/cloudict/blob/master/src/move_generator.cc"
click node_evaluation "https://github.com/lang010/cloudict/blob/master/src/evaluation.cc"
click node_patterns "https://github.com/lang010/cloudict/blob/master/src/pattern.cc"
click node_patternfile "https://github.com/lang010/cloudict/blob/master/patterns.in"
click node_defines "https://github.com/lang010/cloudict/blob/master/src/defines.h"

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_main,node_engine,node_user toneBlue
class node_tools,node_situation,node_defines toneAmber
class node_vcf,node_alpha toneMint
class node_generator,node_evaluation,node_patterns toneRose
class node_patternfile toneTeal
```

## Components

### Command Interface

- [Program Entry](https://github.com/lang010/cloudict/blob/master/src/main.cc): `src/main.cc`
- [Game Engine](https://github.com/lang010/cloudict/blob/master/src/game_engine.cc): `src/game_engine.cc`

### Game State

- [Board and I/O Utilities](https://github.com/lang010/cloudict/blob/master/src/tools.cc): `src/tools.cc`
- [Situation Logic](https://github.com/lang010/cloudict/blob/master/src/situation.cc): `src/situation.cc`
- [Game Types and Constants](https://github.com/lang010/cloudict/blob/master/src/defines.h): `src/defines.h`

### Move Search

- [VCF Search](https://github.com/lang010/cloudict/blob/master/src/vcf_search.cc): `src/vcf_search.cc`
- [Alpha-Beta Search](https://github.com/lang010/cloudict/blob/master/src/search_engine.cc): `src/search_engine.cc`

### Board Analysis

- [Move Generator](https://github.com/lang010/cloudict/blob/master/src/move_generator.cc): `src/move_generator.cc`
- [Board Evaluation](https://github.com/lang010/cloudict/blob/master/src/evaluation.cc): `src/evaluation.cc`
- [Pattern DFA](https://github.com/lang010/cloudict/blob/master/src/pattern.cc): `src/pattern.cc`

### Other components

- **Game Client**
- [VCF Patterns](https://github.com/lang010/cloudict/blob/master/patterns.in): `patterns.in`

## Connections

- Game Client → Program Entry: starts engine (evidence: `README.txt`)
- Program Entry → Game Engine: initializes and runs (evidence: `src/main.cc`)
- Game Client → Game Engine: sends commands (evidence: `README.txt`)
- Game Engine → Board and I/O Utilities: reads and updates board (evidence: `src/game_engine.cc`)
- Game Engine → VCF Search: tries tactical search (evidence: `src/game_engine.cc`)
- Game Engine → Alpha-Beta Search: runs fallback search (evidence: `src/game_engine.cc`)
- Alpha-Beta Search → Move Generator: requests moves (evidence: `src/search_engine.cc`)
- Alpha-Beta Search → Board Evaluation: evaluates leaves (evidence: `src/search_engine.cc`)
- VCF Search → Pattern DFA: uses DFA
- VCF Search → VCF Patterns: loads patterns (evidence: `README.txt`)
- Game Engine → Game Client: returns move (evidence: `src/game_engine.cc`)
