Skip to content

engrrahulrai/java-swing-chess-engine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

Autonomous Java Swing Chess Engine (Matrix Coordinate Validation)

A lightweight desktop chess simulator built completely with native Java graphical user interface frameworks. The application implements an isolated mathematical state tracker across an 8x8 matrix grid to govern turn-based dynamics, programmatic legal move highlights, collision-boundary calculations, and win-state validation structures.

The engine logic—including multi-directional boundary checking, nested array scan iterations, and real-time state mutations—was written entirely within a bare-bones environment (Notepad and the CLI) to build clean proficiency in multidimensional arrays, event dispatch loops, and object-state constraints.


🏗️ Core Engineering & Algorithmic Highlights

  • Multidimensional State Grid: Maps the logical 64-square chessboard directly to an internal 2D array matrix (JButton[8][8]), coupling physical user elements directly with mathematical operational offsets.
  • Handcrafted Move-Validation Matrix: Implements discrete legal move evaluation paths for all piece groups:
    • Linear Ray Scans (Rooks/Queens): Iterates horizontally and vertically across indices until encountering an opposite or matching piece boundary.
    • Diagonal Vector Paths (Bishops/Queens): Compiles synchronized index tracking steps (i--, j++) to assess geometric move vectors.
    • L-Shaped Displacement (Knights): Validates static mathematical index bounds checks to safely handle jumping mechanics without overflowing array limits.
  • Event-Driven State Machine: Leverages a unified ActionListener grid interface. It captures interaction phases, handles turn verification states dynamically, toggles cell selections, and cleans validation borders smoothly across turns.
  • Dynamic Graphical Rendering: Manipulates native runtime assets dynamically using image token validation constraints to map visual assets smoothly over background color matrices.

🧱 Key Technical Blueprint

🚀 Technical Stack

  • Core Technology: Java SE (Swing GUI Architecture, AWT Event Queues, Multidimensional Collections)
  • Layout Management: java.awt.GridLayout (Enforces rigid 8x8 viewport constraint ratios)

📂 Codebase Overview

  • ChessBoard.java: The core standalone engine; handles initialization steps, UI rendering setups, dynamic coordinate mapping loops, collision vectors, and interactive game lifecycle endpoints.

How to Run

  • You need Java Developers Kit to run this game. Download the folder and run the command for compiling the ChessBoard.java and the execute it by JVM.
  • WhatsApp Image 2022-12-09 at 2 12 37 PM

About

A lightweight desktop chess simulation built on native Java Swing grids, featuring custom multi-directional matrix path validations and event-driven state highlights.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages