Skip to content

KlariNoX/Stamina-Chess

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stamina Chess

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.

Gameplay Screenshot

How to run

npm install
npm run dev

Open 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.

Stamina System Details

  • 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.

Debug Panel

The debug panel lets you tweak stamina values in real time without restarting.

Debug Panel

Project Structure

  • 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.

Stuff to do

  • Add sounds
  • Choose more balanced default stamina values.

License

lol. lmao even. Just do as you please with this.

About

A chess variation where pieces have stamina.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published