Rook (model.pieces.rook)¶
model.pieces.rook
¶
Rook chess piece implementation with orthogonal ray moves and moved state.
Rook
¶
Bases: Piece
Rook piece with rank and file ray marching movement and castling readiness tracking.
Source code in src/model/pieces/rook.py
__init__(color, piece_type='rook')
¶
Initialize a Rook piece.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
color
|
int
|
Color identifier (1 for White, -1 for Black). |
required |
piece_type
|
str
|
Piece descriptor (default: "rook"). |
'rook'
|
Source code in src/model/pieces/rook.py
hasMoved()
¶
Check whether the rook has moved from its initial square.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if the rook has moved, False otherwise. |
setMoved(moved=True)
¶
Update whether the rook has moved.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
moved
|
bool
|
New moved state flag (default: True). |
True
|