Design an Object-Oriented Model for a Chess Game
Requirements: Design an object-oriented model for a chess game, covering the board, pieces, players, and move validation.
Design considerations: Class hierarchy for pieces (abstract Piece base class with King, Queen, Rook, Bishop, Knight, Pawn subclasses each implementing their own movement rules), the Board as an 8x8 grid holding piece references, a Player class, and a Game/Match controller that manages turns and detects check/checkmate/stalemate.
Approach: Define Piece as an abstract class with an abstract isValidMove(from, to, board) method; each concrete piece subclass overrides it with its specific movement logic. Board holds a 2D array of Piece (or null) references. Game orchestrates turn order, calls the current piece's isValidMove, applies the move if valid, and checks for check/checkmate conditions after each move. Discuss extensibility (e.g., adding special moves like castling, en passant, pawn promotion).