# reiferd/pindah-badak architecture

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

- Interactive diagram: https://gitdiagram.com/reiferd/pindah-badak
- Repository: https://github.com/reiferd/pindah-badak

## Overview

Pindah Badak! is a Python educational stacking game about relocating Javan rhinos. The player releases a rhino from a swinging crane; the game simulates its fall, checks alignment with the platform or existing stack, and on success adds it to the stack and advances conservation facts. The game engine coordinates input, simulation, scoring, and presentation. Graphics use a scene graph and Pycairo-rendered assets and scenery. Edges reflect calls and data reads shown in excerpts or documented in the README; unsampled details are omitted.

Main entry points: [`src/gameplay/game_engine.py`](https://github.com/reiferd/pindah-badak/blob/main/src/gameplay/game_engine.py) (Game engine), [`src/gameplay/crane.py`](https://github.com/reiferd/pindah-badak/blob/main/src/gameplay/crane.py) (Crane motion and drawing), [`src/education/facts_manager.py`](https://github.com/reiferd/pindah-badak/blob/main/src/education/facts_manager.py) (Fact progression), [`src/graphics/cairo_renderer.py`](https://github.com/reiferd/pindah-badak/blob/main/src/graphics/cairo_renderer.py) (Cairo asset renderer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Game runtime"]
  node_launcher["Game entry point<br/>[run.py]"]
  node_engine["Game engine<br/>[game_engine.py]"]
  node_settings["Game settings<br/>[config.py]"]
end

subgraph group_gameplay["Stacking gameplay"]
  node_crane["Crane motion and drawing<br/>[crane.py]"]
  node_rhino["Rhino fall and alignment<br/>[rhino.py]"]
  node_stack["Stack and score state<br/>[game_engine.py]"]
end

subgraph group_graphics["Graphics"]
  node_scene["Scene graph transforms<br/>[scene_graph.py]"]
  node_renderer["Cairo asset renderer<br/>[cairo_renderer.py]"]
  node_environment["Procedural landscape<br/>[procedural_env.py]"]
end

subgraph group_education["Conservation education"]
  node_education_manager["Fact progression<br/>[facts_manager.py]"]
  node_facts["Conservation facts"]
  node_education_panel["Education panel<br/>[game_engine.py]"]
end

node_player(("Player"))

node_player -->|"controls"| node_engine
node_launcher -->|"starts"| node_engine
node_engine -->|"reads settings"| node_settings
node_engine -->|"updates and draws"| node_crane
node_engine -->|"spawns and updates"| node_rhino
node_engine -->|"draws"| node_environment
node_engine -->|"checks and records"| node_stack
node_stack -->|"advances facts"| node_education_manager
node_education_panel -->|"gets current fact"| node_education_manager
node_education_manager -->|"loads"| node_facts
node_crane -->|"uses transforms"| node_scene
node_crane -->|"renders claw"| node_renderer
node_rhino -->|"renders unit"| node_renderer
node_environment -->|"creates surface"| node_renderer

click node_launcher "https://github.com/reiferd/pindah-badak/blob/main/run.py"
click node_engine "https://github.com/reiferd/pindah-badak/blob/main/src/gameplay/game_engine.py"
click node_settings "https://github.com/reiferd/pindah-badak/blob/main/src/config.py"
click node_crane "https://github.com/reiferd/pindah-badak/blob/main/src/gameplay/crane.py"
click node_scene "https://github.com/reiferd/pindah-badak/blob/main/src/graphics/scene_graph.py"
click node_rhino "https://github.com/reiferd/pindah-badak/blob/main/src/gameplay/rhino.py"
click node_renderer "https://github.com/reiferd/pindah-badak/blob/main/src/graphics/cairo_renderer.py"
click node_environment "https://github.com/reiferd/pindah-badak/blob/main/src/graphics/procedural_env.py"
click node_stack "https://github.com/reiferd/pindah-badak/blob/main/src/gameplay/game_engine.py"
click node_education_manager "https://github.com/reiferd/pindah-badak/blob/main/src/education/facts_manager.py"
click node_facts "https://github.com/reiferd/pindah-badak/blob/main/assets/data/education_data.json"
click node_education_panel "https://github.com/reiferd/pindah-badak/blob/main/src/gameplay/game_engine.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_launcher,node_engine,node_settings toneBlue
class node_crane,node_rhino,node_stack toneAmber
class node_scene,node_renderer,node_environment toneMint
class node_education_manager,node_facts,node_education_panel toneRose
class node_player toneIndigo
```

## Components

### Game runtime

- [Game entry point](https://github.com/reiferd/pindah-badak/blob/main/run.py): `run.py`
- [Game engine](https://github.com/reiferd/pindah-badak/blob/main/src/gameplay/game_engine.py): `src/gameplay/game_engine.py`
- [Game settings](https://github.com/reiferd/pindah-badak/blob/main/src/config.py): `src/config.py`

### Stacking gameplay

- [Crane motion and drawing](https://github.com/reiferd/pindah-badak/blob/main/src/gameplay/crane.py): `src/gameplay/crane.py`
- [Rhino fall and alignment](https://github.com/reiferd/pindah-badak/blob/main/src/gameplay/rhino.py): `src/gameplay/rhino.py`
- [Stack and score state](https://github.com/reiferd/pindah-badak/blob/main/src/gameplay/game_engine.py): `src/gameplay/game_engine.py`

### Graphics

- [Scene graph transforms](https://github.com/reiferd/pindah-badak/blob/main/src/graphics/scene_graph.py): `src/graphics/scene_graph.py`
- [Cairo asset renderer](https://github.com/reiferd/pindah-badak/blob/main/src/graphics/cairo_renderer.py): `src/graphics/cairo_renderer.py`
- [Procedural landscape](https://github.com/reiferd/pindah-badak/blob/main/src/graphics/procedural_env.py): `src/graphics/procedural_env.py`

### Conservation education

- [Fact progression](https://github.com/reiferd/pindah-badak/blob/main/src/education/facts_manager.py): `src/education/facts_manager.py`
- [Conservation facts](https://github.com/reiferd/pindah-badak/blob/main/assets/data/education_data.json): `assets/data/education_data.json`
- [Education panel](https://github.com/reiferd/pindah-badak/blob/main/src/gameplay/game_engine.py): `src/gameplay/game_engine.py`

### Other components

- **Player**

## Connections

- Player → Game engine: controls (evidence: `src/gameplay/game_engine.py`)
- Game entry point → Game engine: starts (evidence: `run.py`)
- Game engine → Game settings: reads settings (evidence: `src/gameplay/game_engine.py`)
- Game engine → Crane motion and drawing: updates and draws (evidence: `src/gameplay/game_engine.py`)
- Game engine → Rhino fall and alignment: spawns and updates (evidence: `src/gameplay/game_engine.py`)
- Game engine → Procedural landscape: draws (evidence: `src/gameplay/game_engine.py`)
- Game engine → Stack and score state: checks and records (evidence: `src/gameplay/game_engine.py`)
- Stack and score state → Fact progression: advances facts (evidence: `src/gameplay/game_engine.py`)
- Education panel → Fact progression: gets current fact (evidence: `src/gameplay/game_engine.py`)
- Fact progression → Conservation facts: loads (evidence: `src/education/facts_manager.py`)
- Crane motion and drawing → Scene graph transforms: uses transforms (evidence: `src/gameplay/crane.py`)
- Crane motion and drawing → Cairo asset renderer: renders claw (evidence: `src/gameplay/crane.py`)
- Rhino fall and alignment → Cairo asset renderer: renders unit (evidence: `src/gameplay/rhino.py`)
- Procedural landscape → Cairo asset renderer: creates surface (evidence: `src/graphics/procedural_env.py`)
