A fully functional chess game built from scratch using vanilla HTML, CSS, and JavaScript. New to chess? Try learning basic openings and tactics to improve your skills!.
Play the Game Here (https://mohammadhamza96.github.io/Chess-/)
- 🏁 Complete Chess Board - Standard 8x8 grid with proper piece positioning
- ♔ All Chess Pieces - King, Queen, Rook, Bishop, Knight, and Pawn with unique movements
- 🎮 Interactive Gameplay - Click to select pieces and make moves
- ⚔️ Move Validation - Ensures only legal chess moves are allowed
- 👑 Check Detection - Alerts when kings are in check
- 🏆 Checkmate & Stalemate - Automatic game end detection
- 🏰 Castling - Both kingside and queenside castling
- 👻 En Passant - Special pawn capture move
- 🎖️ Pawn Promotion - Pawns transform to other pieces upon reaching the end
- 📋 Move History - Track and display all moves made
- 🎨 Beautiful Design - Modern, responsive interface with smooth animations
- 📱 Mobile Friendly - Works seamlessly on desktop and mobile devices
- 🔄 Game Controls - New game and undo functionality
- 📊 Game Status - Real-time display of current player and game state
- 🏴☠️ Captured Pieces - Visual display of captured pieces for both players
- HTML - Semantic structure and game layout
- CSS - Styling, animations, and responsive design
- JavaScript - Game logic, DOM manipulation, and user interactions
- Font Awesome - Icons for enhanced user interface
- A modern web browser (Chrome, Firefox, Safari, Edge)
- Text editor (VS Code recommended)
- Basic understanding of HTML, CSS, and JavaScript
-
Clone the repository
git clone https://github.com/your-username/chess-.git
-
Navigate to project directory
cd chess-game- -
Open with Live Server (VS Code Extension)
- Right-click on
index.html - Select "Open with Live Server"
- Right-click on
-
Or simply open in browser
- Double-click
index.html - Game will load in your default browser
- Double-click
- Start the Game - White pieces move first
- Select a Piece - Click on any piece to see available moves
- Make a Move - Click on a highlighted square to move
- Special Moves - The game automatically handles castling, en passant, and pawn promotion
- Win the Game - Checkmate your opponent's king to win!
chess-game
│
├── index.html # Main HTML structure
├── styles.css # All styling and animations
├── chess.js # Game logic and functionality
└── README.md # Project documentation
This project demonstrates understanding of:
- Object-Oriented Programming - Game state management with classes
- Event Handling - User interactions and game controls
- DOM Manipulation - Dynamic board updates and piece movements
- Algorithm Implementation - Move validation and game logic
- State Management - Tracking game progress and history
- CSS Grid - Chess board layout
- Flexbox - Responsive component arrangement
- Animations - Smooth transitions and hover effects
- Responsive Design - Mobile-first approach
- Semantic HTML - Accessible and meaningful structure
- Modern CSS - Custom properties and advanced selectors
- Performance - Efficient DOM updates and event handling
- Move Validation Engine - Validates moves according to official chess rules
- Check Detection Algorithm - Efficiently determines when kings are in check
- Game State Management - Tracks board position, player turns, and game status
- Special Move Handling - Implements complex rules like castling and en passant
- Modular Design - Well-organized, readable code structure
- Comprehensive Comments - Detailed explanations for learning purposes
- Error Handling - Graceful handling of invalid moves and edge cases
- Responsive Architecture - Adapts to different screen sizes seamlessly
This game serves as an excellent learning resource for:
- Web development fundamentals
- JavaScript programming concepts
- Game development principles
- User interface design
- Problem-solving and algorithm implementation
While this is a university project, suggestions and feedback are welcome:
- Fork the repository
- Create a feature branch (
git checkout -b feature/improvement) - Commit your changes (
git commit -am 'Add some improvement') - Push to the branch (
git push origin feature/improvement) - Open a Pull Request
This project is created for enhancing your chess skills . Feel free to use it as a reference for learning web development and game programming concepts.
Happy Coding! ♟️✨