Package Game
Class Move
java.lang.Object
Game.Move
Represents a chess move, including the piece being moved, its
original and new positions, and any captured piece.
Stores all information needed to validate or execute a move on
the Board
, including old and new coordinates and any piece
that might be captured at the destination.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe piece being captured at the destination, if anyint
The new column of the piece after the move.int
The new row of the piece after the move.int
The original column of the piece before the move.int
The original row of the piece before the move.The piece being moved. -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
oldCol
public int oldColThe original column of the piece before the move. -
oldRow
public int oldRowThe original row of the piece before the move. -
newCol
public int newColThe new column of the piece after the move. -
newRow
public int newRowThe new row of the piece after the move. -
piece
The piece being moved. -
Capture
The piece being captured at the destination, if any
-
-
Constructor Details
-
Move
Constructs the move object that stores the piece's original position, it's destination, and any piece present at the destination square for potential capture.This parameterized constructor creates a
Move
instance by capturing the state of a piece before and after a player action on theBoard
. It records the piece's current column and row, the intended target location, and checks if a piece exists at the destination to handle captures.
-