public class LRPiece extends Piece
| Constructor and Description |
|---|
LRPiece(char[][] board,
char displayChar,
int size,
int topRow,
int leftCol)
Call the superclass (Piece) constructor with the same parameters.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
canMoveDir(Direction d)
Return whether or not the piece is, in general, permitted to move in the given direction.
|
int |
getBottomRow()
Return the row of the piece's bottom right corner.
|
int |
getRightCol()
Return the column of the piece's bottom right corner.
|
getLeftCol, getTopRow, toString, tryMovepublic LRPiece(char[][] board,
char displayChar,
int size,
int topRow,
int leftCol)
board - a reference to the RandomRailroadRushHour char[][] board object common to all piecesdisplayChar - the character used to "paint" the piece on the board representationsize - the size of the piece. For up/down- or left/right-moving train pieces (with width 1), this is the piece length in grid squares.
For left/right/up/down-moving platform pieces, this is the size length in grid squares.topRow - the row of the piece's top left cornerleftCol - the column of the piece's top left cornerpublic int getBottomRow()
PiecegetBottomRow in class Piecepublic int getRightCol()
PiecegetRightCol in class Piecepublic boolean canMoveDir(Direction d)
PiececanMoveDir in class Pieced - given direction of movement