# marcospeedup/whackamolesvg architecture

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

- Interactive diagram: https://gitdiagram.com/marcospeedup/whackamolesvg
- Repository: https://github.com/marcospeedup/whackamolesvg

## Overview

Whack-a-Mole is a browser game: the player starts a timed round, clicks generated SVG moles to score, and can adjust their spawn speed. The runtime is implemented in one JavaScript file and uses page elements identified by IDs; the HTML and CSS are present in the tree, but their contents were not provided. The graph therefore focuses on behavior explicit in the JavaScript excerpt.

Main entry points: [`WhackAMoleSVG/script.js`](https://github.com/marcospeedup/whackamolesvg/blob/main/WhackAMoleSVG/script.js) (Round and controls), [`WhackAMoleSVG/index.html`](https://github.com/marcospeedup/whackamolesvg/blob/main/WhackAMoleSVG/index.html) (Game page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_game["Game runtime"]
  node_page["Game page<br/>[index.html]"]
  node_gameplay["Round and controls<br/>[script.js]"]
  node_moles(("SVG moles<br/>[script.js]"))
  node_score["Score updates<br/>[script.js]"]
  node_timer["Round timer<br/>[script.js]"]
end

node_player(("Player"))

node_player -->|"starts round"| node_gameplay
node_gameplay -->|"reads controls"| node_page
node_gameplay -->|"creates periodically"| node_moles
node_player -->|"clicks"| node_moles
node_moles -->|"increments score"| node_score
node_score -->|"updates display"| node_page
node_gameplay -->|"ends after timeout"| node_timer
node_timer -->|"alerts game over"| node_page
node_gameplay -->|"updates time display"| node_page

click node_page "https://github.com/marcospeedup/whackamolesvg/blob/main/WhackAMoleSVG/index.html"
click node_gameplay "https://github.com/marcospeedup/whackamolesvg/blob/main/WhackAMoleSVG/script.js"
click node_moles "https://github.com/marcospeedup/whackamolesvg/blob/main/WhackAMoleSVG/script.js"
click node_score "https://github.com/marcospeedup/whackamolesvg/blob/main/WhackAMoleSVG/script.js"
click node_timer "https://github.com/marcospeedup/whackamolesvg/blob/main/WhackAMoleSVG/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_page,node_gameplay,node_moles,node_score,node_timer toneBlue
class node_player toneIndigo
```

## Components

### Game runtime

- [Game page](https://github.com/marcospeedup/whackamolesvg/blob/main/WhackAMoleSVG/index.html): `WhackAMoleSVG/index.html`
- [Round and controls](https://github.com/marcospeedup/whackamolesvg/blob/main/WhackAMoleSVG/script.js): `WhackAMoleSVG/script.js`
- [SVG moles](https://github.com/marcospeedup/whackamolesvg/blob/main/WhackAMoleSVG/script.js): `WhackAMoleSVG/script.js`
- [Score updates](https://github.com/marcospeedup/whackamolesvg/blob/main/WhackAMoleSVG/script.js): `WhackAMoleSVG/script.js`
- [Round timer](https://github.com/marcospeedup/whackamolesvg/blob/main/WhackAMoleSVG/script.js): `WhackAMoleSVG/script.js`

### Other components

- **Player**

## Connections

- Player → Round and controls: starts round (evidence: `WhackAMoleSVG/script.js`)
- Round and controls → Game page: reads controls (evidence: `WhackAMoleSVG/script.js`)
- Round and controls → SVG moles: creates periodically (evidence: `WhackAMoleSVG/script.js`)
- Player → SVG moles: clicks (evidence: `WhackAMoleSVG/script.js`)
- SVG moles → Score updates: increments score (evidence: `WhackAMoleSVG/script.js`)
- Score updates → Game page: updates display (evidence: `WhackAMoleSVG/script.js`)
- Round and controls → Round timer: ends after timeout (evidence: `WhackAMoleSVG/script.js`)
- Round timer → Game page: alerts game over (evidence: `WhackAMoleSVG/script.js`)
- Round and controls → Game page: updates time display (evidence: `WhackAMoleSVG/script.js`)
