# iteacher/slither-bot architecture

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

- Interactive diagram: https://gitdiagram.com/iteacher/slither-bot
- Repository: https://github.com/iteacher/slither-bot

## Overview

Hoobs Slither Mod is a Tampermonkey userscript that enhances Slither.io. The main workflow is player settings and toggles → threat/food analysis → avoidance or food-seeking behavior, with overlays and zoom supporting play. The repository is a single 192 KB script, so its distinct responsibilities share mod.js rather than separate modules. The README documents the gameplay relationships; excerpts show canvas discovery and initialization. Other internal links are omitted where the excerpts do not establish them.

Main entry points: [`mod.js`](https://github.com/iteacher/slither-bot/blob/main/mod.js) (Settings Panel)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Userscript Runtime"]
  node_userscript["Mod Runtime<br/>[mod.js]"]
  node_canvas_bootstrap["Canvas Bootstrap<br/>[mod.js]"]
end

subgraph group_gameplay["Gameplay Intelligence"]
  node_threat_radar["Threat Radar<br/>[mod.js]"]
  node_avoidance["Collision Avoidance<br/>[mod.js]"]
  node_food_seeking["Auto-Eat Routing<br/>[mod.js]"]
  node_steering["Steering Input<br/>[mod.js]"]
end

subgraph group_interface["UI And Settings"]
  node_settings_ui["Settings Panel<br/>[mod.js]"]
  node_persistent_settings["Persistent Settings<br/>[mod.js]"]
end

subgraph group_visuals["Visual Enhancements"]
  node_overlays["Gameplay Overlays<br/>[mod.js]"]
  node_zoom["Mouse Scroll Zoom<br/>[mod.js]"]
  node_cursor["Custom Cursor<br/>[mod.js]"]
  node_background["Background Controls<br/>[mod.js]"]
end

node_player(("Player"))
node_slither["Slither.io"]

node_player -->|"configures"| node_settings_ui
node_settings_ui -->|"saves preferences"| node_persistent_settings
node_userscript -->|"waits for canvas"| node_canvas_bootstrap
node_canvas_bootstrap -->|"initializes"| node_userscript
node_userscript -->|"enhances gameplay"| node_slither
node_threat_radar -->|"visualizes threats"| node_overlays
node_avoidance -->|"analyzes heatmap"| node_threat_radar
node_avoidance -->|"calculates steering"| node_steering
node_food_seeking -->|"routes toward food"| node_steering
node_player -->|"scrolls to zoom"| node_zoom
node_player -->|"customizes"| node_cursor
node_player -->|"customizes"| node_background
node_settings_ui -->|"adjusts detection"| node_threat_radar
node_settings_ui -->|"toggles stance"| node_avoidance
node_settings_ui -->|"toggles stance"| node_food_seeking
node_settings_ui -->|"toggles display"| node_overlays

click node_userscript "https://github.com/iteacher/slither-bot/blob/main/mod.js"
click node_canvas_bootstrap "https://github.com/iteacher/slither-bot/blob/main/mod.js"
click node_settings_ui "https://github.com/iteacher/slither-bot/blob/main/mod.js"
click node_persistent_settings "https://github.com/iteacher/slither-bot/blob/main/mod.js"
click node_threat_radar "https://github.com/iteacher/slither-bot/blob/main/mod.js"
click node_avoidance "https://github.com/iteacher/slither-bot/blob/main/mod.js"
click node_food_seeking "https://github.com/iteacher/slither-bot/blob/main/mod.js"
click node_steering "https://github.com/iteacher/slither-bot/blob/main/mod.js"
click node_overlays "https://github.com/iteacher/slither-bot/blob/main/mod.js"
click node_zoom "https://github.com/iteacher/slither-bot/blob/main/mod.js"
click node_cursor "https://github.com/iteacher/slither-bot/blob/main/mod.js"
click node_background "https://github.com/iteacher/slither-bot/blob/main/mod.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_userscript,node_canvas_bootstrap toneBlue
class node_threat_radar,node_avoidance,node_food_seeking,node_steering toneAmber
class node_settings_ui,node_persistent_settings toneMint
class node_overlays,node_zoom,node_cursor,node_background toneRose
class node_player,node_slither toneIndigo
```

## Components

### Userscript Runtime

- [Mod Runtime](https://github.com/iteacher/slither-bot/blob/main/mod.js): `mod.js`
- [Canvas Bootstrap](https://github.com/iteacher/slither-bot/blob/main/mod.js): `mod.js`

### Gameplay Intelligence

- [Threat Radar](https://github.com/iteacher/slither-bot/blob/main/mod.js): `mod.js`
- [Collision Avoidance](https://github.com/iteacher/slither-bot/blob/main/mod.js): `mod.js`
- [Auto-Eat Routing](https://github.com/iteacher/slither-bot/blob/main/mod.js): `mod.js`
- [Steering Input](https://github.com/iteacher/slither-bot/blob/main/mod.js): `mod.js`

### UI And Settings

- [Settings Panel](https://github.com/iteacher/slither-bot/blob/main/mod.js): `mod.js`
- [Persistent Settings](https://github.com/iteacher/slither-bot/blob/main/mod.js): `mod.js`

### Visual Enhancements

- [Gameplay Overlays](https://github.com/iteacher/slither-bot/blob/main/mod.js): `mod.js`
- [Mouse Scroll Zoom](https://github.com/iteacher/slither-bot/blob/main/mod.js): `mod.js`
- [Custom Cursor](https://github.com/iteacher/slither-bot/blob/main/mod.js): `mod.js`
- [Background Controls](https://github.com/iteacher/slither-bot/blob/main/mod.js): `mod.js`

### Other components

- **Player**
- **Slither.io**

## Connections

- Player → Settings Panel: configures (evidence: `README.md`)
- Settings Panel → Persistent Settings: saves preferences (evidence: `README.md`)
- Mod Runtime → Canvas Bootstrap: waits for canvas (evidence: `mod.js`)
- Canvas Bootstrap → Mod Runtime: initializes (evidence: `mod.js`)
- Mod Runtime → Slither.io: enhances gameplay (evidence: `README.md`)
- Threat Radar → Gameplay Overlays: visualizes threats (evidence: `README.md`)
- Collision Avoidance → Threat Radar: analyzes heatmap (evidence: `README.md`)
- Collision Avoidance → Steering Input: calculates steering (evidence: `README.md`)
- Auto-Eat Routing → Steering Input: routes toward food (evidence: `README.md`)
- Player → Mouse Scroll Zoom: scrolls to zoom (evidence: `README.md`)
- Player → Custom Cursor: customizes (evidence: `README.md`)
- Player → Background Controls: customizes (evidence: `README.md`)
- Settings Panel → Threat Radar: adjusts detection (evidence: `README.md`)
- Settings Panel → Collision Avoidance: toggles stance (evidence: `README.md`)
- Settings Panel → Auto-Eat Routing: toggles stance (evidence: `README.md`)
- Settings Panel → Gameplay Overlays: toggles display (evidence: `README.md`)
