# abhijeetadarsh/sssnake architecture

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

- Interactive diagram: https://gitdiagram.com/abhijeetadarsh/sssnake
- Repository: https://github.com/abhijeetadarsh/sssnake

## Overview

This repository appears to implement a terminal Snake game using ncurses. The visible interaction surface is GameWindow: it reads and maps keyboard input, draws game objects, and refreshes the terminal. The tree also identifies game, map, snake, configuration, and shared-model modules, but their implementation and wiring were not excerpted; their relationships are therefore omitted. The shown GameWindow code establishes its dependencies on the shared types and clock, though the SOURCE INDEX does not reveal the broader game loop.

Main entry points: [`GameWindow.cpp`](https://github.com/abhijeetadarsh/sssnake/blob/master/GameWindow.cpp) (Game window), [`ClockGuard.cpp`](https://github.com/abhijeetadarsh/sssnake/blob/master/ClockGuard.cpp) (Clock guard), [`Input.cpp`](https://github.com/abhijeetadarsh/sssnake/blob/master/Input.cpp) (Input types), [`Coordinate.cpp`](https://github.com/abhijeetadarsh/sssnake/blob/master/Coordinate.cpp) (Coordinate)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Terminal interface"]
  node_window["Game window<br/>[GameWindow.cpp]"]
  node_clock["Clock guard<br/>[ClockGuard.cpp]"]
  node_input["Input types<br/>[Input.cpp]"]
end

subgraph group_game["Game runtime"]
  node_main["Program entry<br/>[Main.cpp]"]
  node_game_loop["Game logic<br/>[Game.cpp]"]
  node_snake["Snake<br/>[Snake.cpp]"]
  node_map["Map<br/>[Map.cpp]"]
  node_config["Game config<br/>[GameConfig.cpp]"]
end

subgraph group_model["Shared model"]
  node_coordinate["Coordinate<br/>[Coordinate.cpp]"]
  node_object_type["Object types<br/>[GameObject_T.cpp]"]
  node_global["Shared globals<br/>[Global.cpp]"]
end

node_player(("Player"))

node_player -->|"sends controls"| node_window
node_window -->|"ticks"| node_clock
node_window -->|"returns input"| node_input
node_window -->|"uses dimensions"| node_coordinate
node_window -->|"draws types"| node_object_type
node_window -->|"reads glyphs"| node_global

click node_window "https://github.com/abhijeetadarsh/sssnake/blob/master/GameWindow.cpp"
click node_clock "https://github.com/abhijeetadarsh/sssnake/blob/master/ClockGuard.cpp"
click node_input "https://github.com/abhijeetadarsh/sssnake/blob/master/Input.cpp"
click node_main "https://github.com/abhijeetadarsh/sssnake/blob/master/Main.cpp"
click node_game_loop "https://github.com/abhijeetadarsh/sssnake/blob/master/Game.cpp"
click node_snake "https://github.com/abhijeetadarsh/sssnake/blob/master/Snake.cpp"
click node_map "https://github.com/abhijeetadarsh/sssnake/blob/master/Map.cpp"
click node_config "https://github.com/abhijeetadarsh/sssnake/blob/master/GameConfig.cpp"
click node_coordinate "https://github.com/abhijeetadarsh/sssnake/blob/master/Coordinate.cpp"
click node_object_type "https://github.com/abhijeetadarsh/sssnake/blob/master/GameObject_T.cpp"
click node_global "https://github.com/abhijeetadarsh/sssnake/blob/master/Global.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_window,node_clock,node_input toneBlue
class node_main,node_game_loop,node_snake,node_map,node_config toneAmber
class node_coordinate,node_object_type,node_global toneMint
class node_player toneIndigo
```

## Components

### Terminal interface

- [Game window](https://github.com/abhijeetadarsh/sssnake/blob/master/GameWindow.cpp): `GameWindow.cpp`
- [Clock guard](https://github.com/abhijeetadarsh/sssnake/blob/master/ClockGuard.cpp): `ClockGuard.cpp`
- [Input types](https://github.com/abhijeetadarsh/sssnake/blob/master/Input.cpp): `Input.cpp`

### Game runtime

- [Program entry](https://github.com/abhijeetadarsh/sssnake/blob/master/Main.cpp): `Main.cpp`
- [Game logic](https://github.com/abhijeetadarsh/sssnake/blob/master/Game.cpp): `Game.cpp`
- [Snake](https://github.com/abhijeetadarsh/sssnake/blob/master/Snake.cpp): `Snake.cpp`
- [Map](https://github.com/abhijeetadarsh/sssnake/blob/master/Map.cpp): `Map.cpp`
- [Game config](https://github.com/abhijeetadarsh/sssnake/blob/master/GameConfig.cpp): `GameConfig.cpp`

### Shared model

- [Coordinate](https://github.com/abhijeetadarsh/sssnake/blob/master/Coordinate.cpp): `Coordinate.cpp`
- [Object types](https://github.com/abhijeetadarsh/sssnake/blob/master/GameObject_T.cpp): `GameObject_T.cpp`
- [Shared globals](https://github.com/abhijeetadarsh/sssnake/blob/master/Global.cpp): `Global.cpp`

### Other components

- **Player**

## Connections

- Player → Game window: sends controls (evidence: `GameWindow.cpp`)
- Game window → Clock guard: ticks (evidence: `GameWindow.cpp`)
- Game window → Input types: returns input (evidence: `GameWindow.cpp`)
- Game window → Coordinate: uses dimensions (evidence: `GameWindow.cpp`)
- Game window → Object types: draws types (evidence: `GameWindow.cpp`)
- Game window → Shared globals: reads glyphs (evidence: `GameWindow.cpp`)
