Skip to content

Jay-Patel-Developer/CHESS-GAME

Repository files navigation

Chess Game Application

A full-featured chess game built with React and TypeScript, featuring AI opponents, move validation, and comprehensive game mechanics.

๐ŸŽฏ Project Overview

This chess application provides a complete chess playing experience with multiple difficulty levels, move validation, game state management, and an intuitive user interface. The project evolved from implementing basic bot play to a fully-featured chess application.

๐Ÿ› ๏ธ Technologies & Libraries Used

Core Technologies

  • React 18 - Frontend framework
  • TypeScript - Type safety and better development experience
  • Vite - Fast build tool and development server
  • CSS3 - Styling and animations

Chess Engine & AI

  • chess.js - Chess game logic, move validation, and game state management
  • Custom AI Engine - Multiple difficulty levels with different evaluation strategies

UI Components & Styling

  • Lucide React - Modern icon library for UI elements
  • CSS Grid & Flexbox - Layout and responsive design
  • Custom Components - Reusable chess piece and board components

Development Tools

  • ESLint - Code linting and quality
  • TypeScript Compiler - Type checking
  • React DevTools - Development debugging

๐Ÿš€ Features Implemented

Phase 1: Bot Play Foundation

  • โœ… Basic chess board rendering
  • โœ… Chess piece representation and display
  • โœ… Simple random move AI opponent
  • โœ… Move validation using chess.js
  • โœ… Turn-based gameplay

Phase 2: Enhanced AI & Game Logic

  • โœ… Multiple AI difficulty levels (Easy, Medium, Hard)
  • โœ… Position evaluation algorithms
  • โœ… Minimax algorithm with alpha-beta pruning
  • โœ… Advanced move scoring and piece value calculations
  • โœ… Strategic position assessment

Phase 3: Complete Chess Mechanics

  • โœ… Full chess rule implementation
  • โœ… Special moves (castling, en passant, pawn promotion)
  • โœ… Check and checkmate detection
  • โœ… Draw conditions (stalemate, insufficient material, 50-move rule)
  • โœ… Move history and game state tracking

Phase 4: User Interface & Experience

  • โœ… Interactive drag-and-drop piece movement
  • โœ… Click-to-move piece selection
  • โœ… Visual move highlights and indicators
  • โœ… Game status display (check, checkmate, draw)
  • โœ… Move history panel with algebraic notation
  • โœ… Responsive design for different screen sizes

Phase 5: Advanced Features

  • โœ… Game difficulty selection
  • โœ… New game functionality
  • โœ… Move animation and smooth transitions
  • โœ… Captured pieces display
  • โœ… Game timer (optional)
  • โœ… Piece promotion dialog

๐ŸŽฎ How to Play

  1. Start a Game: Select difficulty level and click "New Game"
  2. Make Moves:
    • Click a piece to select it
    • Click the destination square to move
    • Or drag and drop pieces
  3. AI Response: The computer will automatically make its move
  4. Special Moves: All standard chess moves are supported
  5. Game End: The game will detect checkmate, stalemate, or draw conditions

๐Ÿค– AI Difficulty Levels

Easy

  • Random move selection with basic piece safety
  • Suitable for beginners
  • No deep position analysis

Medium

  • 2-3 move lookahead
  • Basic position evaluation
  • Considers piece values and simple tactics

Hard

  • 4-5 move lookahead with alpha-beta pruning
  • Advanced position evaluation
  • Strategic planning and tactical awareness

๐Ÿ—๏ธ Project Structure

chess-game/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ components/          # React components
โ”‚   โ”‚   โ”œโ”€โ”€ ChessBoard.tsx   # Main game board
โ”‚   โ”‚   โ”œโ”€โ”€ ChessPiece.tsx   # Individual pieces
โ”‚   โ”‚   โ””โ”€โ”€ GameControls.tsx # Game control panel
โ”‚   โ”œโ”€โ”€ hooks/              # Custom React hooks
โ”‚   โ”œโ”€โ”€ utils/              # Chess logic and AI
โ”‚   โ”‚   โ”œโ”€โ”€ chess-ai.ts     # AI implementation
โ”‚   โ”‚   โ””โ”€โ”€ chess-utils.ts  # Game utilities
โ”‚   โ”œโ”€โ”€ types/              # TypeScript definitions
โ”‚   โ””โ”€โ”€ App.tsx             # Main application
โ”œโ”€โ”€ public/                 # Static assets
โ””โ”€โ”€ package.json           # Dependencies

๐Ÿš€ Getting Started

Prerequisites

  • Node.js (v16 or higher)
  • npm or yarn

Installation

# Clone the repository
git clone <repository-url>
cd chess-game

# Install dependencies
npm install

# Start development server
npm run dev

# Build for production
npm run build

๐ŸŽฏ Future Enhancements

  • Online multiplayer support
  • Game save/load functionality
  • Opening book integration
  • Advanced AI with neural networks
  • Tournament mode
  • Chess puzzle solver
  • Analysis board with engine evaluation

๐Ÿ“ Development Journey

The project started with implementing basic bot play and evolved through several phases:

  1. Initial Setup: Basic React app with chess board visualization
  2. Bot Integration: Added chess.js and simple AI opponent
  3. AI Enhancement: Implemented multiple difficulty levels with strategic evaluation
  4. UI Polish: Added animations, better controls, and responsive design
  5. Feature Complete: Full chess rules, special moves, and game state management

๐Ÿค Contributing

Feel free to submit issues, feature requests, or pull requests to improve the chess game.

๐Ÿ“„ License

This project is open source and available under the MIT License.

About

Live Chess

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors