Spaces:
Sleeping
Chess Engine Web UI
A modern, interactive web interface for the chess engine using React and Tailwind CSS.
Features
- Interactive chess board with piece movement
- Visual indicators for legal moves (green dots)
- Hint system with highlighted squares
- Game controls (new game, undo, resign)
- Position analysis display
- Move history tracking
- Responsive design for various screen sizes
- Multiple board themes (brown and grey)
Setup
WSL Setup (Recommended)
If you're using Windows Subsystem for Linux (WSL):
- Run the setup script to install all dependencies:
chmod +x setup.sh
./setup.sh
- Copy the chess assets to the public folder:
chmod +x copy-assets.sh
./copy-assets.sh
- Start the development server:
npm run dev
For detailed WSL-specific instructions, see WSL_SETUP.md.
Windows Setup
- Run the setup script to install all dependencies:
setup.bat
Copy the chess assets to the public folder (see Asset Setup section below)
Start the development server:
npm run dev
Manual Setup
- Install dependencies:
npm install --save react react-dom axios
npm install --save-dev typescript @types/react @types/react-dom @vitejs/plugin-react vite tailwindcss postcss autoprefixer
- Start the development server:
npm run dev
- Build for production:
npm run build
Troubleshooting TypeScript Errors
If you encounter TypeScript errors related to React, try these steps:
- Make sure all dependencies are installed:
npm install
- If you see "Cannot find module 'react'" errors, try:
# WSL/Linux
./fix-dependencies.sh
# Windows
fix-dependencies.bat
Restart your IDE or TypeScript server
For detailed instructions, see TYPESCRIPT_FIXES.md
Asset Setup
Before running the application, you need to copy the chess assets to the public folder:
- Copy all files from
frontend/assets/piecestofrontend/web/public/assets/pieces - Copy all files from
frontend/assets/boards/browntofrontend/web/public/assets/boards/brown - Copy all files from
frontend/assets/boards/greytofrontend/web/public/assets/boards/grey
Or use the provided script:
# WSL/Linux
./copy-assets.sh
High-Resolution Assets
For high-resolution displays:
- Copy your 2x assets to the same folders, keeping the same naming convention but with "2x" instead of "1x"
- Example:
b_bishop_1x.pngandb_bishop_2x.pngshould both be in the pieces folder
Backend Integration
The web UI communicates with the chess engine's REST API. Make sure the backend API is running on port 8000 or update the proxy configuration in vite.config.ts to match your backend URL.
Technologies Used
- React 18
- TypeScript
- Tailwind CSS
- Vite
- Axios for API communication