Skip to content
← portfolio·
case study

Map Game

wip2025

A click-based geography quiz across six regions with color-graded feedback — green on first try, escalating to red as you miss.

No map library — every region is a pure SVG path, shuffled into a queue at game start. Correct answers pop the queue; wrong or skipped answers go to the back and bump the region's color toward red. react-zoom-pan-pinch handles pan and zoom on mobile and trackpad.

WebSix regionsPure SVGWork in progress
⬡ view on github
Map Game — US states quiz, light theme
architecture

How It Works

Each game mode exports a Region[] of { id, name, abbreviation, svgPath } consumed by a shared useMapGame hook. The hook shuffles regions into a queue at start: a correct click pops the head, a wrong or skipped one rotates it to the tail and increments its attempt count. Color intensity is a function of attempts — first-try green, mid-difficulty yellow/orange, hard red — so the finished map doubles as a heatmap of your weak spots.

// region queue
game loop
Region[]
id · name · svgPath
Shuffle
randomize order
Queue head
current target
↓ user clicks
correct
Pop queue
next target
wrong / skip
Rotate to tail
attempts++ color: green → red
stack

Tech Stack

Frontend
Next.js 16 App Router · React 19 · TypeScript
Styling
Tailwind CSS v4 · shadcn/ui · Radix · next-themes
Icons
lucide-react
Maps
Pure SVG paths — no external map library
Interaction
react-zoom-pan-pinch (pan + zoom)
Data
Static Region[] arrays · client-only, no API
Build
pnpm · Next 16 turbopack
features

Key Features

Six game modes — US states, Europe, Africa, Asia, North America, South America
Random region queue — skip moves the target to the back of the queue
Color-graded attempt feedback (green / yellow / orange / red)
Timer plus per-region attempt counter in the results dialog
Pinch and scroll zoom on mobile and trackpad
Per-mode settings — e.g. Asia toggle for "Show Disputed Territories"
Dark, light, and system theme toggle