Files
cpl_cpp-project/MoveGenerator.hpp
2022-12-23 23:57:29 +01:00

41 lines
1.7 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 "BoardState.hpp"
#include <optional>
#include <iosfwd>
#include <vector>
#include <memory>
class MoveGenerator {
public:
using MoveVec = std::vector<Move>;
static void generatePawnMoves(const BoardState &bs, const Square &from, MoveVec &moves);
static void generateBishopMoves(const BoardState &bs, const Square &from, MoveVec &moves);
static void generateKingMoves(const BoardState &bs, const Square &from, MoveVec &moves);
static void generateRookMoves(const BoardState &bs, const Square &from, MoveVec &moves);
static void generateQueenMoves(const BoardState &bs, const Square &from, MoveVec &moves);
static void generateKnightMoves(const BoardState &bs, const Square &from, MoveVec &moves);
static BitBoard generateAttackedSquares(const BoardState &bs, BitBoard target, PieceColor opColor);
static unsigned int Mobility(const BoardState &bs, PieceColor color);
private:
static void generatePawnMoves(const BoardState &bs, const Square &from, BitBoard targets, MoveVec &moves);
static void generateMoves(const BoardState &bs, const Square &from, BitBoard movesBB, PieceType pt, MoveVec &moves);
static void generateMovesWithPromotion(const BoardState &bs, const Square &from, BitBoard movesBB, MoveVec &moves);
inline static bool isCheck(const BoardState &bs, const BitBoard &fromBB, const BitBoard &toBB);
inline static unsigned score(const BoardState &bs, const BitBoard &toBB, PieceType moved);
};
#endif //CHESS_ENGINE_MOVEGENERATOR_HPP