Skip to content

josh671/chess

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

74 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

โ™” Chess Game Frontend

A real-time multiplayer chess game built with React and Socket.IO. Join rooms, play against friends, and experience chess with full rule validation and elegant UI.

Chess Game Demo

โœจ Features

  • ๐ŸŽฎ Real-time Multiplayer - Play live games with friends using room codes
  • โ™Ÿ๏ธ Complete Chess Rules - Full implementation including castling, en passant, and promotion
  • ๐ŸŽฏ Move Validation - Client-side move highlighting with server-side validation
  • ๐Ÿ‘‘ Pawn Promotion - Interactive promotion dialog with piece selection
  • โšก Live Game States - Real-time check/checkmate detection and game status updates
  • ๐Ÿ“ฑ Responsive Design - Clean, modern UI that works on all devices
  • ๐Ÿ† Game History - Track moves with algebraic notation display

๐Ÿš€ Quick Start

# Install dependencies
npm install

# Start development server
npm start

# Open http://localhost:3000

๐ŸŽฏ How to Play

1. Join a Room: Enter a room code and click "Join Game"
2. Get Assigned: Server automatically assigns you White or Black pieces
3. Make Moves: Click pieces to see valid moves, then click destination
4. Special Moves:
  - Castle by moving king two squares
  - Promote pawns when reaching the end
  - En passant captures work automatically

๐Ÿ—๏ธ Project Structure

src/
โ”œโ”€โ”€ Components/
โ”‚   โ”œโ”€โ”€ Board/              # Chess board and game display
โ”‚   โ”‚   โ”œโ”€โ”€ Board.jsx       # Main board component
โ”‚   โ”‚   โ”œโ”€โ”€ PastMoves.jsx   # Move history display
โ”‚   โ”‚   โ””โ”€โ”€ bits/           # Board coordinates (ranks/files)
โ”‚   โ”œโ”€โ”€ Pieces/             # Chess piece logic and rendering
โ”‚   โ”œโ”€โ”€ Popup/              # Game dialogs (promotion, game end)
โ”‚   โ”œโ”€โ”€ Context/            # React context and Socket.IO integration
โ”‚   โ””โ”€โ”€ Reducer/            # Game state management
โ”œโ”€โ”€ Constants.js            # Game configuration and initial state
โ””โ”€โ”€ App.jsx                # Main application component

๐Ÿ”ง Tech Stack

- React 18 - Modern React with hooks and context
- Socket.IO Client - Real-time communication with game server
- CSS3 - Custom styling with chess-themed design
- React Testing Library - Component testing framework

๐ŸŽจ Key Components

- App.jsx - Handles room joining and main game flow
- Board.jsx - Renders chess board and manages move interactions
- Pieces.jsx - Individual piece components with drag/click handlers
- Context.jsx - Global state management and socket connection
- PromotionBox.jsx - Pawn promotion piece selection dialog

๐Ÿ”— Backend Integration

This frontend connects to a Node.js backend server running on port 3001. Make sure the backend is running before starting the frontend.

๐Ÿš€ Available Scripts

- npm start - Start development server
- npm run build - Build for production
- npm test - Run test suite
- npm run eject - Eject from Create React App

๐Ÿค Contributing

Feel free to submit issues and pull requests to improve the game!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors