Chess engine for developers. Pieces are services, board is architecture, checkmate is prod outage, castling is failover.
- JavaScript 100%
| node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709 | ||
| src | ||
| tests | ||
| package.json | ||
| README.md | ||
code-chess
Chess engine for developers. Pieces are services, board is architecture, checkmate is prod outage, castling is failover.
Usage
const { Board, PIECE_TYPES } = require('./src/chess');
const board = new Board();
console.log(board.render());
// Make moves
board.makeMove(6, 4, 4, 4); // e2-e4 (pawn/microservice advances)
board.makeMove(0, 6, 2, 5); // Ng8-f6 (knight/worker deploys)
// AI plays itself
while (!board.gameOver && board.moveHistory.length < 50) {
board.aiMove(board.turn);
}
console.log(board.render());
console.log(board.status());
console.log('FEN:', board.toFEN());
Piece Mapping
- King (Core Service) — value 1000, lose it and the game is over
- Queen (Database) — value 9, most powerful, handles everything
- Rook (Cache Layer) — value 5, straight-line scaling
- Bishop (Message Queue) — value 3, diagonal/async routing
- Knight (Worker Process) — value 3, jumps over everything, background jobs
- Pawn (Microservice) — value 1, can promote (scale up) at end of board
Features
- Full legal move validation for all 6 piece types
- Pawn promotion (microservice scales to full service)
- King capture = game over (prod outage)
- Simple AI (capture-priority with random tiebreak)
- FEN notation export (infra state snapshot)
- ASCII board with coordinate labels
- Move history (deploy log)
- Check detection