[MoveGenerator] Add MoveGenerator
This commit is contained in:
36
MoveGenerator.hpp
Normal file
36
MoveGenerator.hpp
Normal file
@@ -0,0 +1,36 @@
|
||||
#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
|
Reference in New Issue
Block a user