Skip to content

Harshv2608/Chess_game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

♟ Chess Engine

A fully rule-compliant chess engine built from scratch using HTML, CSS, and Vanilla JavaScript.

This project implements real chess rules with a clean architecture that separates engine logic from UI rendering.


🚀 Live Demo

(You can deploy this using GitHub Pages)

👉 Live Demo Link: [https://harshv2608.github.io/Chess_game/]


📸 Screenshots

🏁 Main Board View

image

♜ Move Highlighting

image

👑 Pawn Promotion Modal

image

📜 Move History & Undo

image

✨ Features

♟ Core Chess Rules

  • Full piece movement validation
  • Turn-based gameplay
  • Prevents illegal moves
  • Self-check prevention
  • Check detection
  • Checkmate detection
  • Stalemate detection

🏰 Special Moves

  • Castling (King-side & Queen-side with proper validation)
  • En Passant
  • Pawn Promotion (UI-based modal selection)

🔁 Game Management

  • Undo system (restores full board state)
  • Move history sidebar
  • Last move highlighting
  • King-in-check highlighting

🎨 UI & Design

  • Modern responsive chess board
  • Equal-sized grid squares using CSS Grid
  • Professional typography
  • Clean dark-themed side panel
  • Smooth hover animations
  • Highlight indicators using border effects (not background override)

🧠 Architecture

The project is structured around a clean separation of concerns:

1️⃣ Game Engine (Logic Layer)

  • 2D board representation
  • Central move validation system
  • Check detection through board simulation
  • Castling rights tracking
  • En passant target tracking
  • Full game state serialization for undo

2️⃣ Rendering Layer (UI)

  • DOM-based board rendering
  • Dynamic square highlighting
  • Promotion modal overlay
  • Move history display

The engine is completely independent of the UI logic.


🛠 Technologies Used

  • HTML5
  • CSS3 (Grid, Flexbox, Modern Styling)
  • Vanilla JavaScript (ES6+)
  • No external chess libraries
  • No frameworks

Everything is implemented manually from scratch.


🎯 Learning Objectives

This project demonstrates understanding of:

  • Data structures (2D arrays for board state)
  • State management
  • Algorithmic move validation
  • Simulation-based rule enforcement
  • Event-driven programming
  • DOM manipulation
  • Clean UI architecture
  • Game logic implementation

🔄 How to Run Locally

  1. Clone the repository:
git clone https://github.com/Harshv2608/Chess_game.git
  1. Open the project folder.
  2. Launch index.html in your browser.

No installation or dependencies required.


📌 Future Enhancements

  • Drag-and-drop piece movement
  • Chess timers
  • AI opponent (Minimax algorithm)
  • PGN export
  • FEN import/export
  • Online multiplayer (WebSockets)
  • Sound effects
  • Theme switcher (Classic / Modern / Neon)

👨‍💻 Author

Harsh Vardhan

If you found this project interesting or helpful, consider giving it a ⭐ on GitHub.


📜 License

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

About

A fully rule-compliant chess engine built from scratch using HTML, CSS, and Vanilla JavaScript. Implements advanced mechanics like castling validation, en passant, promotion UI, check/checkmate detection, undo functionality, and structured board state management.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors