Java (1)[1] (1)
Java (1)[1] (1)
CHESS BOARD
Aditya: Game Logic & ValidationChess piece movement rulesCheck/checkmate detectionMove history and
undo/redoPawn promotion handlingStalemate detection
o Chess is a two-player strategy game played on an 8×8 board where each player controls 16 pieces
(king, queen, rooks, bishops, knights, and pawns).
o The goal is to checkmate your opponent’s king, meaning the king is under attack and can't escape
capture.
o It’s a game of tactics, planning, and foresight — often called the "game of kings" because it mixes
logic, creativity, and strategy
o Use classes for pieces and extend them for different types like King, Queen, and Pawn.
o Create a Board class with a 2D array of Piece objects to represent the chessboard.
o Implement movement logic within each piece class to validate their moves.
o Create a Game Manager class to handle turns, move validation, and check/checkmate detection.
o Build a simple user interface to print the board and update it after each move.
UML DIAGRAM
USE DIAGRAM
OOPS concepts being used in the code
Encapsulation
• Piece class bundles color and type together and hides internal setup.
• setIcon method controls how board pieces are updated instead of allowing direct access.
Abstraction
• getImageIcon method hides the complexity of mapping pieces to images.
• initiateBoard method abstracts the detailed setup of the initial chessboard.
Inheritance
• ButtonListener class inherits behavior from the ActionListener interface.
• GUI components like JPanel and JButton inherit properties from AWT/Swing hierarchy.
Polymorphism
• actionPerformed method behaves differently based on which button triggers it.
• getImageIcon method behaves differently depending on the piece type it receives.
GUI Design Of Our Code
Challenges And What We Learned From Code.
Final Outcome:
The final outcome is a fully functional chess game in Java with correct piece movement,
special moves, turn management, check/checkmate detection, and either a console or GUI
interface for player interaction.