A small chess game built with TypeScript, chess.js, and esbuild. It includes a stamina system that limits how often pieces can move, plus a debug panel to tweak stamina values.
npm install
npm run devOpen the URL printed in your terminal (it's http://localhost:5173 on my machine, but idk if its the same for everyone 😅). Click pieces to move; undo recomputes stamina from history.
- Each piece type has max, drain (cost to move), and regen (gained after a friendly move if the piece did not move).
- A piece with 0 stamina cannot move until it regens above 0 on its turn.
- Captured pieces are removed from stamina tracking.
- Promotions remove the pawn entry and create a fresh entry for the promoted piece with full max stamina for that type.
- Undo rebuilds stamina by replaying move history from the initial FEN so state stays correct.
The debug panel lets you tweak stamina values in real time without restarting.
src/main.ts– bootstraps the app, builds DOM, wires controls, debug panel.src/board.ts– renders pieces and stamina bars on squares.src/game.ts– wraps chess.js and implements stamina logic, move gating, undo/recompute, config.src/interactions.ts– click handling, selection, promotions, and move execution.src/ui.ts– status text and move list.src/style.css– layout, board/piece styling, promotion and stamina bar styles, debug panel styles.
- Add sounds
- Choose more balanced default stamina values.
lol. lmao even. Just do as you please with this.

