29 lines
1.1 KiB
C++

#include "Queen.hpp"
/**
* Creates a new queen with a specified color and position.
* @param color The color of the queen.
* @param position The position of the queen.
*/
Queen::Queen(ChessPieceColor color, ChessPiecePosition position) : ChessPiece(color, position) {
this->_char = this->_CHAR_QUEEN;
this->_unicode = {"\u265B", "\u2655"};
}
/**
* Gets all chess piece positions the queen 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 queen can move next.
*/
std::set<ChessPiecePosition> Queen::GetNextPositions(Chessboard* chessboard, std::set<ChessPiecePosition> ignore) {
// 3.4. The queen may move to any square along the file, the rank or a diagonal on which it stands.
std::set<ChessPiecePosition> positions;
positions.merge(this->GetFilePositions(chessboard, ignore));
positions.merge(this->GetRankPositions(chessboard, ignore));
positions.merge(this->GetDiagonalPositions(chessboard, ignore));
return positions;
}