25 lines
961 B
C++
25 lines
961 B
C++
#include "Bishop.hpp"
|
|
|
|
/**
|
|
* Creates a new bishop with a specified color and position.
|
|
* @param color The color of the bishop.
|
|
* @param position The position of the bishop.
|
|
*/
|
|
Bishop::Bishop(ChessPieceColor color, ChessPiecePosition position) : ChessPiece(color, position) {
|
|
this->_char = this->_CHAR_BISHOP;
|
|
this->_unicode = {"\u265D", "\u2657"};
|
|
}
|
|
|
|
/**
|
|
* Gets all chess piece positions the bishop can move next.
|
|
* It is also possible to ignore several chess pieces while the next positions are calculated.
|
|
* @param chessboard A pointer to the chessboard.
|
|
* @param ignore A set of chess piece positions to be ignored.
|
|
* @return A set of chess piece positions the bishop can move next.
|
|
*/
|
|
std::set<ChessPiecePosition> Bishop::GetNextPositions(Chessboard* chessboard, std::set<ChessPiecePosition> ignore) {
|
|
|
|
// 3.2. The bishop may move to any square along a diagonal on which it stands.
|
|
return this->GetDiagonalPositions(chessboard, ignore);
|
|
}
|