๐Ÿ“š

DOCUMENTATION

Developer and maintainer reference for the Tetris project.

Documents

README.md

Project overview, quick start (file:// and bundle), embed instructions, controls summary, and file structure.

Open README.md โ†’

ARCHITECTURE.md

Module responsibilities, layout, auto mode, game state machine, grid layer, dependency graph, and canvas layers.

Open ARCHITECTURE.md โ†’

DEVELOPMENT.md

Bundle workflow, config reference, customization, deployment checklist, troubleshooting, and version history.

Open DEVELOPMENT.md โ†’

help.html

Player-facing guide: controls (including auto mode), scoring, combos, strategy tips, and FAQ.

Open help.html โ†’

Quick Reference

Live URL

linhtruong.com/game/tetris

Entry Point

Browser loads index.html โ†’ js/app.js (bundled IIFE). Works over file:// โ€” no server required for players.

Source modules in js/*.js (except app.js) are ES modules. After editing, run node scripts/bundle.js.

Key Config File

js/config.js โ€” board size, timing (DAS, lock delay), scoring, drop speeds, game states.

Project Tree

Tetris/ โ”œโ”€โ”€ index.html โ”œโ”€โ”€ help.html โ”œโ”€โ”€ README.md โ”œโ”€โ”€ docs/ โ”‚ โ”œโ”€โ”€ index.html โ† you are here โ”‚ โ”œโ”€โ”€ ARCHITECTURE.md โ”‚ โ””โ”€โ”€ DEVELOPMENT.md โ”œโ”€โ”€ css/ โ”‚ โ”œโ”€โ”€ style.css โ”‚ โ””โ”€โ”€ help.css โ”œโ”€โ”€ scripts/ โ”‚ โ””โ”€โ”€ bundle.js builds js/app.js โ””โ”€โ”€ js/ โ”œโ”€โ”€ app.js bundled runtime (index.html loads this) โ”œโ”€โ”€ main.js bootstrap (dev / module mode) โ”œโ”€โ”€ tetris.js game engine โ”œโ”€โ”€ board.js board state โ”œโ”€โ”€ grid.js shared grid helpers (board + AI) โ”œโ”€โ”€ auto.js auto-play AI โ”œโ”€โ”€ board-scaling.js responsive canvas sizing โ”œโ”€โ”€ piece.js tetrominoes & SRS โ”œโ”€โ”€ config.js constants โ”œโ”€โ”€ scoring.js points & high score โ”œโ”€โ”€ das.js horizontal input โ”œโ”€โ”€ lock-delay.js lock timer โ”œโ”€โ”€ renderer.js canvas drawing โ”œโ”€โ”€ particles.js effects โ”œโ”€โ”€ ambience.js background โ”œโ”€โ”€ presentation.js DOM effects โ”œโ”€โ”€ ui.js UI controller โ”œโ”€โ”€ controls.js keyboard/touch โ””โ”€โ”€ audio.js sound & music

Local Development

Play / test production build

# Double-click index.html, or: open index.html

Edit source and rebuild

# After changing js/*.js (not app.js): node scripts/bundle.js # Then refresh index.html

Optional: ES module dev server

Temporarily point index.html at js/main.js with type="module", then serve over HTTP:
cd Tetris python3 -m http.server 8080 # Open http://localhost:8080