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