# games
**Repository Path**: codegoder/games
## Basic Information
- **Project Name**: games
- **Description**: 小游戏厅:12 款浏览器小游戏合集(4096/贪吃蛇/俄罗斯方块/扫雷/打砖块/五子棋…),纯前端,最高分存本机
- **Primary Language**: Unknown
- **License**: MIT
- **Default Branch**: main
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2026-10-27
- **Last Updated**: 2026-10-27
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# Games Hall · 小游戏厅
> 12 small browser games behind one page: 4096, Snake, Tetris, Minesweeper, Breakout, Flappy, Memory, Whack-a-mole, Sliding puzzle, Space shooter, Dino run, Gomoku. No install, no account; high scores stay in your browser.
**English** | [简体中文](README.zh-CN.md)
▶ Live demo
## The 12 games
| Game | Controls |
|---|---|
| **4096** | Arrows / WASD, swipe on mobile; Space toggles AI autopilot (1–10× speed), Backspace undoes a move |
| **Snake** | Arrows / WASD to turn, Space pause, R restart |
| **Tetris** | ←→ move, ↑ rotate, ↓ soft drop, Space hard drop, C hold |
| **Minesweeper** | Click to reveal, right-click / flag mode to mark |
| **Breakout** | Mouse or ←→ to move the paddle |
| **Flappy** | Space / click to flap |
| **Memory** | Flip pairs, fewer moves is better |
| **Whack-a-mole** | Click the mole before it hides |
| **Sliding puzzle** | Click a tile or use arrows |
| **Space shooter** | Arrows to move, Space to fire |
| **Dino run** | Space / click to jump, ↓ to duck |
| **Gomoku** | Click an intersection; U undoes |
## Architecture: 12 games, 118 KB of JS
Every game is a **framework-free ES module** that exports one object:
```js
export default {
id: 'snake',
name: '贪吃蛇',
options: [{ key: 'size', label: '盘面', def: 4, values: [...] }], // optional
runtime: [{ key: 'auto', label: '操作', def: 'off', values: [...] }], // optional
mount(container, api) { /* draw into container */ return { destroy() {}, setRuntime(k, v) {} } }
}
```
`api` is a tiny surface: `score(v)`, `over(v)`, `win(v)`, `status(text)`, `options` (live getter),
`setRuntime(key, value)`. The shell only knows these five things — which is why adding a game means writing
one file and adding one registry row, with no changes to the hall.
Shared drawing helpers (`setupCanvas`, `onKey`, `onSwipe`, `roundRect`, `centerText`, …) live in
`games/canvasKit.js`; games that are DOM-based instead of canvas (Minesweeper, Memory) just build elements.
**Most games render to `