# joaorizzo0112/snake-retro-gba architecture

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

- Interactive diagram: https://gitdiagram.com/joaorizzo0112/snake-retro-gba
- Repository: https://github.com/joaorizzo0112/snake-retro-gba

## Overview

Snake Retro Console is a browser-based Snake game presented as a responsive retro handheld. The player selects a mode, starts and steers a run, then sees score and level progress; the README documents Classic, Portal, and Bonus modes. The sampled JavaScript confirms input handling, game updates, canvas rendering, audio, and per-mode high-score storage. Other documented presentation and gameplay capabilities are represented from the README; wiring not established by the excerpts is omitted.

Main entry points: [`script.js`](https://github.com/joaorizzo0112/snake-retro-gba/blob/main/script.js) (Collision Rules), [`index.html`](https://github.com/joaorizzo0112/snake-retro-gba/blob/main/index.html) (Game Console), [`style.css`](https://github.com/joaorizzo0112/snake-retro-gba/blob/main/style.css) (Responsive Layout)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Handheld Interface"]
  node_console["Game Console<br/>[index.html]"]
  node_responsive["Responsive Layout<br/>[style.css]"]
  node_renderer["Canvas Renderer<br/>[script.js]"]
end

subgraph group_gameplay["Game Runtime"]
  node_controls["Keyboard And D-pad<br/>[script.js]"]
  node_menu["Menu And Modes<br/>[script.js]"]
  node_snake["Snake Movement<br/>[script.js]"]
  node_collisions["Collision Rules<br/>[script.js]"]
  node_food["Food And Bonus<br/>[script.js]"]
  node_levels["Level Speed<br/>[script.js]"]
end

subgraph group_feedback["Progress And Feedback"]
  node_scoreboard["Scoreboard<br/>[script.js]"]
  node_highscores[("Mode High Scores<br/>[script.js]")]
  node_audio["Sound And Music<br/>[script.js]"]
end

node_player(("Player"))

node_player -->|"uses"| node_console
node_player -->|"steers"| node_controls
node_console -->|"styled by"| node_responsive
node_controls -->|"navigates"| node_menu
node_controls -->|"sets direction"| node_snake
node_menu -->|"loads mode score"| node_highscores
node_snake -->|"checks movement"| node_collisions
node_collisions -->|"detects pickup"| node_food
node_food -->|"updates score"| node_scoreboard
node_food -->|"advances progress"| node_levels
node_levels -->|"sets speed"| node_snake
node_snake -->|"renders game"| node_renderer
node_collisions -->|"plays effects"| node_audio
node_collisions -->|"saves record"| node_highscores
node_menu -->|"renders attract mode"| node_renderer

click node_console "https://github.com/joaorizzo0112/snake-retro-gba/blob/main/index.html"
click node_responsive "https://github.com/joaorizzo0112/snake-retro-gba/blob/main/style.css"
click node_controls "https://github.com/joaorizzo0112/snake-retro-gba/blob/main/script.js"
click node_menu "https://github.com/joaorizzo0112/snake-retro-gba/blob/main/script.js"
click node_snake "https://github.com/joaorizzo0112/snake-retro-gba/blob/main/script.js"
click node_collisions "https://github.com/joaorizzo0112/snake-retro-gba/blob/main/script.js"
click node_food "https://github.com/joaorizzo0112/snake-retro-gba/blob/main/script.js"
click node_levels "https://github.com/joaorizzo0112/snake-retro-gba/blob/main/script.js"
click node_renderer "https://github.com/joaorizzo0112/snake-retro-gba/blob/main/script.js"
click node_scoreboard "https://github.com/joaorizzo0112/snake-retro-gba/blob/main/script.js"
click node_highscores "https://github.com/joaorizzo0112/snake-retro-gba/blob/main/script.js"
click node_audio "https://github.com/joaorizzo0112/snake-retro-gba/blob/main/script.js"

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_console,node_responsive,node_renderer toneBlue
class node_controls,node_menu,node_snake,node_collisions,node_food,node_levels toneAmber
class node_scoreboard,node_highscores,node_audio toneMint
class node_player toneIndigo
```

## Components

### Handheld Interface

- [Game Console](https://github.com/joaorizzo0112/snake-retro-gba/blob/main/index.html): `index.html`
- [Responsive Layout](https://github.com/joaorizzo0112/snake-retro-gba/blob/main/style.css): `style.css`
- [Canvas Renderer](https://github.com/joaorizzo0112/snake-retro-gba/blob/main/script.js): `script.js`

### Game Runtime

- [Keyboard And D-pad](https://github.com/joaorizzo0112/snake-retro-gba/blob/main/script.js): `script.js`
- [Menu And Modes](https://github.com/joaorizzo0112/snake-retro-gba/blob/main/script.js): `script.js`
- [Snake Movement](https://github.com/joaorizzo0112/snake-retro-gba/blob/main/script.js): `script.js`
- [Collision Rules](https://github.com/joaorizzo0112/snake-retro-gba/blob/main/script.js): `script.js`
- [Food And Bonus](https://github.com/joaorizzo0112/snake-retro-gba/blob/main/script.js): `script.js`
- [Level Speed](https://github.com/joaorizzo0112/snake-retro-gba/blob/main/script.js): `script.js`

### Progress And Feedback

- [Scoreboard](https://github.com/joaorizzo0112/snake-retro-gba/blob/main/script.js): `script.js`
- [Mode High Scores](https://github.com/joaorizzo0112/snake-retro-gba/blob/main/script.js): `script.js`
- [Sound And Music](https://github.com/joaorizzo0112/snake-retro-gba/blob/main/script.js): `script.js`

### Other components

- **Player**

## Connections

- Player → Game Console: uses
- Player → Keyboard And D-pad: steers
- Game Console → Responsive Layout: styled by
- Keyboard And D-pad → Menu And Modes: navigates
- Keyboard And D-pad → Snake Movement: sets direction
- Menu And Modes → Mode High Scores: loads mode score
- Snake Movement → Collision Rules: checks movement
- Collision Rules → Food And Bonus: detects pickup
- Food And Bonus → Scoreboard: updates score
- Food And Bonus → Level Speed: advances progress
- Level Speed → Snake Movement: sets speed
- Snake Movement → Canvas Renderer: renders game
- Collision Rules → Sound And Music: plays effects
- Collision Rules → Mode High Scores: saves record
- Menu And Modes → Canvas Renderer: renders attract mode
