Val Town Chess

A fully functional chess game implemented in Val Town. This game includes:

Features

  • Complete chess rules implementation
  • Legal move validation
  • Check and checkmate detection
  • Castling (kingside and queenside)
  • En passant captures
  • Pawn promotion
  • Move history with algebraic notation
  • Game state tracking (active, check, checkmate, stalemate)
  • Draw detection (50-move rule, insufficient material)
  • Undo move functionality
  • Mobile-responsive design

How to Play

  1. Visit the HTTP endpoint for this Val
  2. White moves first, followed by Black
  3. Click on a piece to select it and see valid moves
  4. Click on a highlighted square to move the selected piece
  5. Use the "New Game" button to reset the board
  6. Use the "Undo Move" button to take back the last move

Implementation Details

The game is built with vanilla JavaScript and uses Unicode chess symbols for the pieces. The game logic handles all chess rules including special moves and edge cases.

  • index.ts - HTTP handler that serves the game
  • index.html - Main HTML file with the game UI
  • css/style.css - Styling for the chess board and UI
  • js/chess.js - Complete chess game logic

Future Improvements

Potential enhancements that could be added:

  • Computer opponent (AI)
  • Game persistence (save/load games)
  • Multiplayer support
  • Time controls
  • PGN import/export
  • Opening book integration