Class Shoot
java.lang.Object
com.chess.backend.gamemodel.abstractmoves.Shoot
Represents the implementation of a cannon shoot.
-
Method Summary
Modifier and TypeMethodDescriptionconcretise
(Chessboard chessboard, Piece piece, boolean attack, boolean jump, boolean peaceful) Generate concrete possible shoots from a given piece and game context.getNeighborPos
(Chessboard chessboard, Position fromPos, Player activePlayer) shoot
(Chessboard chessboard, Piece piece, boolean attack, boolean jump, boolean peaceful, int limit) Generate concrete possible moves from a given piece and game context.
-
Method Details
-
concretise
public static Set<Move> concretise(Chessboard chessboard, Piece piece, boolean attack, boolean jump, boolean peaceful) Generate concrete possible shoots from a given piece and game context. Direction: Depends on neighbors, no limit- Parameters:
chessboard
- The chessboard.piece
- The originating square.attack
- Whether the piece may move to an occupied square. This would result in an attack with a captured piece.jump
- Whether the piece may jump over other pieces (e.g. the knight).peaceful
- Whether peaceful moves are allowed (moves to an unoccupied square).- Returns:
- HashSet of concrete moves
-
shoot
public static Set<Move> shoot(Chessboard chessboard, Piece piece, boolean attack, boolean jump, boolean peaceful, int limit) Generate concrete possible moves from a given piece and game context. Direction: Depends on neighbors, limit can be set- Parameters:
chessboard
- The chessboard.piece
- The originating square.attack
- Whether the piece may move to an occupied square. This would result in an attack with a captured piece.jump
- Whether the piece may jump over other pieces (e.g. the knight).peaceful
- Whether peaceful moves are allowed (moves to an unoccupied square).limit
- The maximum of steps.- Returns:
- HashSet of concrete moves
-
getNeighborPos
public static List<Integer> getNeighborPos(Chessboard chessboard, Position fromPos, Player activePlayer)
-