37 lines
1.2 KiB
C++
37 lines
1.2 KiB
C++
#ifndef CHESS_ENGINE_MOVEGENERATOR_HPP
|
|
#define CHESS_ENGINE_MOVEGENERATOR_HPP
|
|
|
|
#include "Piece.hpp"
|
|
#include "Square.hpp"
|
|
#include "Move.hpp"
|
|
#include "CastlingRights.hpp"
|
|
#include "BitBoard.hpp"
|
|
|
|
#include <optional>
|
|
#include <iosfwd>
|
|
#include <vector>
|
|
#include <memory>
|
|
|
|
class MoveGenerator {
|
|
public:
|
|
using MoveVec = std::vector<Move>;
|
|
|
|
MoveGenerator(const std::shared_ptr<BitBoard[]>& pieceBB, const std::shared_ptr<BitBoard>& occupiedBB);
|
|
MoveGenerator(MoveGenerator &) = delete;
|
|
MoveGenerator &operator=(MoveGenerator const &) = delete;
|
|
|
|
void generatePawnMoves(const Square &from, const std::optional<Square> &eps, PieceColor color, MoveVec &moves) const;
|
|
void generatePawnMoves(const Square &from, PieceColor color, MoveVec &moves);
|
|
|
|
private:
|
|
const std::shared_ptr<const BitBoard[]> mPieceBBs;
|
|
const std::shared_ptr<const BitBoard> mOccupiedBB;
|
|
|
|
void generatePawnMoves(const Square &from, BitBoard targets, PieceColor color, MoveVec &moves) const;
|
|
|
|
static void generateMoves(const Square &from, BitBoard movesBB, MoveVec &moves);
|
|
static void generateMovesWithPromotion(const Square &from, BitBoard movesBB, MoveVec &moves);
|
|
};
|
|
|
|
#endif //CHESS_ENGINE_MOVEGENERATOR_HPP
|