sa_chess
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in miliseconds.
index.ts
https://pro3--2ba84f5c328e11f097c4569c3dd06744.web.val.run
A fully functional chess game implemented in Val Town. This game includes:
- 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
- Visit the HTTP endpoint for this Val
- White moves first, followed by Black
- Click on a piece to select it and see valid moves
- Click on a highlighted square to move the selected piece
- Use the "New Game" button to reset the board
- Use the "Undo Move" button to take back the last move
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 gameindex.html
- Main HTML file with the game UIcss/style.css
- Styling for the chess board and UIjs/chess.js
- Complete chess game logic
Potential enhancements that could be added:
- Computer opponent (AI)
- Game persistence (save/load games)
- Multiplayer support
- Time controls
- PGN import/export
- Opening book integration