⚠ Switch to EXCALIDRAW VIEW in the MORE OPTIONS menu of this document. ⚠
Text Elements
Requirements
- Design a OOP approach to a board game with squares.
- Three types of pieces:
- Can move one square in any non-diagonal direction.
- Can move any number of squares in diagonals, can’t move over other pieces.
- Can move two squares in any non-diagonal direction, but must jump over another piece.
Piece (Abstract)
Spot
abstract getAvailableMoves(board: Board) → list[tuple[int, int]]
board = list[list[Piece | None]];
void init(self) → void;
// should call Piece.getAvailableMoves() and // prompt the player for which square they want // to move to. void movePiece(src, dest) → void;
JumpingPiece
KingPiece
DiagonalPiece
occupant: Piece | None; void repr() → string;
Board