|
@@ -9,57 +9,11 @@ template class PawnPushGenerator<BLACK_SIDE>;
|
|
|
|
|
|
std::string Move::asString(void) const
|
|
|
{
|
|
|
- return origin.getName() + "-" + destination.getName();
|
|
|
+ return origin.getName() + destination.getName();
|
|
|
}
|
|
|
|
|
|
|
|
|
-std::vector<Move> MoveGenerator::generatePossibleMoves(void) const
|
|
|
-{
|
|
|
- const ChessGame& cg = game;
|
|
|
- Bitboard whites = cg.getBoard().getWhites();
|
|
|
- Bitboard blacks = cg.getBoard().getBlacks();
|
|
|
- std::vector<Move> ret;
|
|
|
- PawnPushGenerator<BLACK_SIDE> mg{ cg };
|
|
|
- for (auto push : mg)
|
|
|
- ret.push_back(push);
|
|
|
- PositionSet knights = cg.getBoard().getBlackKnights();
|
|
|
- for (auto knight : knights) {
|
|
|
- for (auto pos : KnightMoveGenerator{ knight, blacks }) {
|
|
|
- ret.push_back(Move{ knight, pos });
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- PositionSet bishops = cg.getBoard().getBlackBishops();
|
|
|
- for (auto bishop : bishops) {
|
|
|
- for (auto pos : PrimitiveBishopMoveGenerator{ bishop, whites, blacks }) {
|
|
|
- ret.push_back(Move{ bishop, pos });
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- PositionSet rooks = cg.getBoard().getBlackRooks();
|
|
|
- for (auto rook : rooks) {
|
|
|
- for (auto pos : PrimitiveRookMoveGenerator{ rook, whites, blacks }) {
|
|
|
- //cout << "rook: " << Move(rook, pos).asString() << endl;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- PositionSet queens = cg.getBoard().getBlackQueens();
|
|
|
- for (auto queen : queens) {
|
|
|
- for (auto pos : PrimitiveQueenMoveGenerator{ queen, whites, blacks }) {
|
|
|
- //cout << "queen: " << Move(queen, pos).asString() << endl;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- Bitboard king = cg.getBoard().getBlackKings();
|
|
|
- Index kingIndex = king.getLeastSignificantBit();
|
|
|
- for (auto pos : KingMoveGenerator{ king, blacks }) {
|
|
|
- //cout << "king: " << Move(kingIndex, pos).asString() << endl;
|
|
|
- }
|
|
|
- return ret;
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-template<int side>
|
|
|
+template<Side side>
|
|
|
typename PawnPushGenerator<side>::MoveIterator PawnPushGenerator<side>::begin(void) const
|
|
|
{
|
|
|
const Board& board = chessGame.getBoard();
|
|
@@ -77,7 +31,7 @@ typename PawnPushGenerator<side>::MoveIterator PawnPushGenerator<side>::begin(vo
|
|
|
}
|
|
|
|
|
|
|
|
|
-template<int side>
|
|
|
+template<Side side>
|
|
|
typename PawnPushGenerator<side>::MoveIterator PawnPushGenerator<side>::end(void) const
|
|
|
{
|
|
|
return MoveIterator{ 0 };
|