Bishop
Bishop piece.
A bishop is a piece with long rang movements on diagonals.
Value parameters
- c
-
The color of the piece.
- p
-
The position of the piece.
Attributes
- Graph
-
- Supertypes
Members list
Value members
Concrete methods
Available movements of the bishop.
Available movements of the bishop.
The bishop can go to all the squares of its diagonals, until it reaches another piece. If this piece is of another color, it can capture it.
Value parameters
- enemiesPieces
-
The enemies pieces.
- friendlyPieces
-
The allies pieces.
Attributes
- Returns
-
The list of square the bishop can go.
- Definition Classes
Inherited methods
The color of the piece.
A piece cannot move if it puts its king in check.
A piece cannot move if it puts its king in check.
This function filters valid moves from invalid ones. It verifies if the king is not the direct target of enemies pieces once the piece has moved.
The function does not modify any of the parameters, neither the piece itself.
Value parameters
- enemiesPieces
-
The enemies pieces.
- friendlyKing
-
The ally king.
- friendlyPieces
-
The allies pieces.
- targetPosition
-
The square the piece wants to go.
Attributes
- Returns
-
true if the move is valid, false otherwise.
- Inherited from:
- Piece
Move a piece.
Move a piece.
This function moves a piece by moving its given position.
Value parameters
- newColumn
-
The new position column
- newRow
-
The new position row
Attributes
- Inherited from:
- Piece
Move a piece.
Move a piece.
This function moves a piece by moving its given position.
Value parameters
- newPos
-
The new position
Attributes
- Inherited from:
- Piece
Inherited fields
Movements for long range pieces.
Movements for long range pieces.
Returns a list containing all the squares in the given direction from the piece Position until it reaches either the end of the board or a piece.
If the last square is an enemy piece, keep it to the list (because it can be captured)
Attributes
- Inherited from:
- Piece