A simple chess game implemented using React.
- Interactive Chessboard: A fully functional 8x8 chessboard rendered using React components.
- Piece Movement: Implements movement rules for all chess pieces (Pawn, Rook, Knight, Bishop, Queen, and King).
- Turn-Based Gameplay: Alternates turns between White and Black players.
- Move Validation: Validates moves according to chess rules, including checks for valid paths and piece collisions.
- Highlighting Valid Moves: Highlights available moves for a selected piece.
- Check and Checkmate Detection: Detects check and checkmate situations using hooks.
- Castling: Implements castling move for the King and Rook pieces.
- Responsive Design: Adapts the board size to the screen size.
- React: A JavaScript library for building user interfaces.
- JavaScript (ES6+): The primary programming language.
- JSX: A syntax extension to JavaScript, used to describe UI components.
- CSS: For styling the application.
- Vite: A build tool that provides a fast and efficient development experience.
- Context API: For managing application state.
Before running the application, ensure you have the following installed:
- Node.js: JavaScript runtime environment. Download from https://nodejs.org/
- npm (Node Package Manager): Usually comes with Node.js installation.
- Git: Recommended for cloning the repository.
-
Clone the repository:
git clone https://github.com/bitan2504/Chess.git cd Chess
-
Install dependencies:
npm install
-
Start the development server:
npm run dev
This will typically start the application at
http://localhost:5173/
. Open this URL in your browser. -
Playing the Game:
- Click on a chess piece to select it. Valid moves for the selected piece will be highlighted.
- Click on a highlighted square to move the piece to that location.
- The game automatically switches turns between White and Black.
- The game displays alerts for checkmate and when a player wins.
-
Fork the repository.
-
Create a new branch for your feature:
git checkout -b feature-name
-
Make changes and commit:
git add . git commit -m "Added a new feature"
-
Push to your branch:
git push origin feature-name
-
Create a Pull Request (PR) on GitHub.
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
Currently, two official plugins are available:
- @vitejs/plugin-react uses Babel for Fast Refresh
- @vitejs/plugin-react-swc uses SWC for Fast Refresh
This project does not expose a public API.
Contributions are welcome! To contribute:
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Implement your changes.
- Test your changes thoroughly.
- Submit a pull request with a clear description of your changes.