# trungmegalikeit/mastercarogame architecture

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

- Interactive diagram: https://gitdiagram.com/trungmegalikeit/mastercarogame
- Repository: https://github.com/trungmegalikeit/mastercarogame

## Overview

This is a small Pygame Caro (gomoku-style) game. The user launches the app, uses the start/settings screens to enter a match, places alternating stones on the board, and wins by making a line of five. The graph follows the documented screen routing and the calls visible in sampled source; it omits uncertain details for unsampled files.

Main entry points: [`app.py`](https://github.com/trungmegalikeit/mastercarogame/blob/main/app.py) (App loop), [`gameScreen.py`](https://github.com/trungmegalikeit/mastercarogame/blob/main/gameScreen.py) (Game screen), [`screen.py`](https://github.com/trungmegalikeit/mastercarogame/blob/main/screen.py) (Screen base), [`Button.py`](https://github.com/trungmegalikeit/mastercarogame/blob/main/Button.py) (Buttons)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Game runtime"]
  node_entry["Game entry<br/>[main.py]"]
  node_app["App loop<br/>[app.py]"]
  node_states["Screen states<br/>[states.py]"]
  node_settings["Game configuration<br/>[settings.py]"]
end

subgraph group_screens["Game screens"]
  node_start["Start screen<br/>[startScreen.py]"]
  node_settings_screen["Settings screen<br/>[settingScreen.py]"]
  node_game_screen["Game screen<br/>[gameScreen.py]"]
  node_screen_base["Screen base<br/>[screen.py]"]
end

subgraph group_gameplay["Board gameplay"]
  node_board["Caro board<br/>[board.py]"]
end

subgraph group_ui["UI and rendering"]
  node_button["Buttons<br/>[Button.py]"]
  node_textures["Generated textures<br/>[textures.py]"]
end

node_player(("Player"))

node_player -->|"launches"| node_entry
node_entry -->|"starts"| node_app
node_app -->|"creates"| node_start
node_app -->|"creates"| node_settings_screen
node_app -->|"creates"| node_game_screen
node_app -->|"selects state"| node_states
node_start -->|"navigates"| node_app
node_settings_screen -->|"navigates"| node_app
node_game_screen -->|"navigates"| node_app
node_game_screen -->|"owns"| node_board
node_start -->|"inherits"| node_screen_base
node_settings_screen -->|"inherits"| node_screen_base
node_game_screen -->|"inherits"| node_screen_base
node_screen_base -->|"dispatches events"| node_button
node_screen_base -->|"reads colors"| node_settings
node_start -->|"creates"| node_button
node_settings_screen -->|"creates"| node_button
node_game_screen -->|"creates"| node_button
node_game_screen -->|"reads layout"| node_settings
node_board -->|"reads rules"| node_settings
node_board -->|"creates background"| node_textures
node_button -->|"creates surfaces"| node_textures
node_button -->|"reads style"| node_settings
node_board -->|"receives events"| node_screen_base

click node_entry "https://github.com/trungmegalikeit/mastercarogame/blob/main/main.py"
click node_app "https://github.com/trungmegalikeit/mastercarogame/blob/main/app.py"
click node_states "https://github.com/trungmegalikeit/mastercarogame/blob/main/states.py"
click node_start "https://github.com/trungmegalikeit/mastercarogame/blob/main/startScreen.py"
click node_settings_screen "https://github.com/trungmegalikeit/mastercarogame/blob/main/settingScreen.py"
click node_game_screen "https://github.com/trungmegalikeit/mastercarogame/blob/main/gameScreen.py"
click node_screen_base "https://github.com/trungmegalikeit/mastercarogame/blob/main/screen.py"
click node_board "https://github.com/trungmegalikeit/mastercarogame/blob/main/board.py"
click node_button "https://github.com/trungmegalikeit/mastercarogame/blob/main/Button.py"
click node_textures "https://github.com/trungmegalikeit/mastercarogame/blob/main/textures.py"
click node_settings "https://github.com/trungmegalikeit/mastercarogame/blob/main/settings.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_entry,node_app,node_states,node_settings toneBlue
class node_start,node_settings_screen,node_game_screen,node_screen_base toneAmber
class node_board toneMint
class node_button,node_textures toneRose
class node_player toneIndigo
```

## Components

### Game runtime

- [Game entry](https://github.com/trungmegalikeit/mastercarogame/blob/main/main.py): `main.py`
- [App loop](https://github.com/trungmegalikeit/mastercarogame/blob/main/app.py): `app.py`
- [Screen states](https://github.com/trungmegalikeit/mastercarogame/blob/main/states.py): `states.py`
- [Game configuration](https://github.com/trungmegalikeit/mastercarogame/blob/main/settings.py): `settings.py`

### Game screens

- [Start screen](https://github.com/trungmegalikeit/mastercarogame/blob/main/startScreen.py): `startScreen.py`
- [Settings screen](https://github.com/trungmegalikeit/mastercarogame/blob/main/settingScreen.py): `settingScreen.py`
- [Game screen](https://github.com/trungmegalikeit/mastercarogame/blob/main/gameScreen.py): `gameScreen.py`
- [Screen base](https://github.com/trungmegalikeit/mastercarogame/blob/main/screen.py): `screen.py`

### Board gameplay

- [Caro board](https://github.com/trungmegalikeit/mastercarogame/blob/main/board.py): `board.py`

### UI and rendering

- [Buttons](https://github.com/trungmegalikeit/mastercarogame/blob/main/Button.py): `Button.py`
- [Generated textures](https://github.com/trungmegalikeit/mastercarogame/blob/main/textures.py): `textures.py`

### Other components

- **Player**

## Connections

- Player → Game entry: launches (evidence: `main.py`)
- Game entry → App loop: starts (evidence: `main.py`)
- App loop → Start screen: creates (evidence: `app.py`)
- App loop → Settings screen: creates (evidence: `app.py`)
- App loop → Game screen: creates (evidence: `app.py`)
- App loop → Screen states: selects state (evidence: `app.py`)
- Start screen → App loop: navigates (evidence: `startScreen.py`)
- Settings screen → App loop: navigates (evidence: `settingScreen.py`)
- Game screen → App loop: navigates (evidence: `gameScreen.py`)
- Game screen → Caro board: owns (evidence: `gameScreen.py`)
- Start screen → Screen base: inherits (evidence: `startScreen.py`)
- Settings screen → Screen base: inherits (evidence: `settingScreen.py`)
- Game screen → Screen base: inherits (evidence: `gameScreen.py`)
- Screen base → Buttons: dispatches events (evidence: `screen.py`)
- Screen base → Game configuration: reads colors (evidence: `screen.py`)
- Start screen → Buttons: creates (evidence: `startScreen.py`)
- Settings screen → Buttons: creates (evidence: `settingScreen.py`)
- Game screen → Buttons: creates (evidence: `gameScreen.py`)
- Game screen → Game configuration: reads layout (evidence: `gameScreen.py`)
- Caro board → Game configuration: reads rules (evidence: `board.py`)
- Caro board → Generated textures: creates background (evidence: `board.py`)
- Buttons → Generated textures: creates surfaces (evidence: `Button.py`)
- Buttons → Game configuration: reads style (evidence: `Button.py`)
- Caro board → Screen base: receives events (evidence: `screen.py`)
