# leotkiet/bloxfruit-prj2 architecture

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

- Interactive diagram: https://gitdiagram.com/leotkiet/bloxfruit-prj2
- Repository: https://github.com/leotkiet/bloxfruit-prj2

## Overview

Griductive is a logic-based grid deduction game. A player works through a puzzle in the desktop GUI: the engine loads and validates puzzle data, exposes only public state, and checks submitted verdicts through a deduction agent; accepted verdicts reveal clues and advance play. The documented product also includes CNF logic, SAT solving, automatic solving, hints, and uniqueness checks. Several of those implementations are not sampled, so their nodes and links reflect documented interfaces rather than inspected runtime calls.

Main entry points: [`Source/engine/game_engine.py`](https://github.com/leotkiet/bloxfruit-prj2/blob/main/Source/engine/game_engine.py) (Game engine), [`Source/agent`](https://github.com/leotkiet/bloxfruit-prj2/tree/main/Source/agent) (Deduction agent), [`Source/gui`](https://github.com/leotkiet/bloxfruit-prj2/tree/main/Source/gui) (Desktop GUI), [`Source/engine/puzzle_loader.py`](https://github.com/leotkiet/bloxfruit-prj2/blob/main/Source/engine/puzzle_loader.py) (Puzzle loading)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_play["Game runtime"]
  node_gui["Desktop GUI"]
  node_engine["Game engine<br/>[game_engine.py]"]
  node_loader["Puzzle loading<br/>[puzzle_loader.py]"]
  node_validator["Puzzle validation"]
end

subgraph group_reason["Deduction system"]
  node_agent["Deduction agent"]
  node_logic["CNF logic"]
  node_solver["DPLL solver"]
  node_experiments["Experiments"]
end

subgraph group_shared["Shared contracts"]
  node_contracts["Contracts and models<br/>[models.py]"]
end

subgraph group_content["Puzzle content"]
  node_puzzles[("Puzzle data")]
end

node_player(("Player"))

node_player -->|"plays through"| node_gui
node_gui -->|"uses engine"| node_engine
node_gui -->|"requests deductions"| node_agent
node_engine -->|"checks verdicts"| node_agent
node_engine -->|"loads puzzle"| node_loader
node_engine -->|"validates puzzle"| node_validator
node_loader -->|"reads JSON"| node_puzzles
node_engine -->|"uses state models"| node_contracts
node_loader -->|"parses clue models"| node_contracts
node_validator -->|"validates models"| node_contracts
node_agent -.->|"encodes knowledge"| node_logic
node_agent -.->|"solves SAT queries"| node_solver
node_logic -.->|"cross-checks"| node_solver
node_agent -->|"auto-solves through"| node_engine

click node_gui "https://github.com/leotkiet/bloxfruit-prj2/tree/main/Source/gui"
click node_engine "https://github.com/leotkiet/bloxfruit-prj2/blob/main/Source/engine/game_engine.py"
click node_loader "https://github.com/leotkiet/bloxfruit-prj2/blob/main/Source/engine/puzzle_loader.py"
click node_validator "https://github.com/leotkiet/bloxfruit-prj2/blob/main/Source/engine/puzzle_validator.py"
click node_agent "https://github.com/leotkiet/bloxfruit-prj2/tree/main/Source/agent"
click node_logic "https://github.com/leotkiet/bloxfruit-prj2/tree/main/Source/logic"
click node_solver "https://github.com/leotkiet/bloxfruit-prj2/tree/main/Source/solver"
click node_experiments "https://github.com/leotkiet/bloxfruit-prj2/tree/main/Source/experiments"
click node_contracts "https://github.com/leotkiet/bloxfruit-prj2/blob/main/Source/core/contracts/models.py"
click node_puzzles "https://github.com/leotkiet/bloxfruit-prj2/tree/main/Source/puzzles"

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_gui,node_engine,node_loader,node_validator toneBlue
class node_agent,node_logic,node_solver,node_experiments toneAmber
class node_contracts toneMint
class node_puzzles toneRose
class node_player toneIndigo
```

## Components

### Game runtime

- [Desktop GUI](https://github.com/leotkiet/bloxfruit-prj2/tree/main/Source/gui): `Source/gui`
- [Game engine](https://github.com/leotkiet/bloxfruit-prj2/blob/main/Source/engine/game_engine.py): `Source/engine/game_engine.py`
- [Puzzle loading](https://github.com/leotkiet/bloxfruit-prj2/blob/main/Source/engine/puzzle_loader.py): `Source/engine/puzzle_loader.py`
- [Puzzle validation](https://github.com/leotkiet/bloxfruit-prj2/blob/main/Source/engine/puzzle_validator.py): `Source/engine/puzzle_validator.py`

### Deduction system

- [Deduction agent](https://github.com/leotkiet/bloxfruit-prj2/tree/main/Source/agent): `Source/agent`
- [CNF logic](https://github.com/leotkiet/bloxfruit-prj2/tree/main/Source/logic): `Source/logic`
- [DPLL solver](https://github.com/leotkiet/bloxfruit-prj2/tree/main/Source/solver): `Source/solver`
- [Experiments](https://github.com/leotkiet/bloxfruit-prj2/tree/main/Source/experiments): `Source/experiments`

### Shared contracts

- [Contracts and models](https://github.com/leotkiet/bloxfruit-prj2/blob/main/Source/core/contracts/models.py): `Source/core/contracts/models.py`

### Puzzle content

- [Puzzle data](https://github.com/leotkiet/bloxfruit-prj2/tree/main/Source/puzzles): `Source/puzzles`

### Other components

- **Player**

## Connections

- Player → Desktop GUI: plays through
- Desktop GUI → Game engine: uses engine
- Desktop GUI → Deduction agent: requests deductions
- Game engine → Deduction agent: checks verdicts (evidence: `Source/engine/game_engine.py`)
- Game engine → Puzzle loading: loads puzzle (evidence: `Source/engine/game_engine.py`)
- Game engine → Puzzle validation: validates puzzle (evidence: `Source/engine/game_engine.py`)
- Puzzle loading → Puzzle data: reads JSON (evidence: `Source/engine/puzzle_loader.py`)
- Game engine → Contracts and models: uses state models (evidence: `Source/engine/game_engine.py`)
- Puzzle loading → Contracts and models: parses clue models (evidence: `Source/engine/puzzle_loader.py`)
- Puzzle validation → Contracts and models: validates models (evidence: `Source/engine/puzzle_validator.py`)
- Deduction agent → CNF logic: encodes knowledge
- Deduction agent → DPLL solver: solves SAT queries
- CNF logic → DPLL solver: cross-checks
- Deduction agent → Game engine: auto-solves through
