#include "bitcount.h"
#include "movegen.h"
+#include "position.h"
// Simple macro to wrap a very common while loop, no facny, no flexibility,
// hardcoded list name 'mlist' and from square 'from'.
template<MoveType Type>
MoveStack* generate(const Position& pos, MoveStack* mlist) {
- assert(pos.is_ok());
assert(!pos.in_check());
Color us = pos.side_to_move();
template<>
MoveStack* generate<MV_NON_CAPTURE_CHECK>(const Position& pos, MoveStack* mlist) {
- assert(pos.is_ok());
assert(!pos.in_check());
Bitboard b, dc;
assert(pos.piece_on(ksq) == make_piece(opposite_color(us), KING));
// Discovered non-capture checks
- b = dc = pos.discovered_check_candidates(us);
+ b = dc = pos.discovered_check_candidates();
while (b)
{
template<>
MoveStack* generate<MV_EVASION>(const Position& pos, MoveStack* mlist) {
- assert(pos.is_ok());
assert(pos.in_check());
Bitboard b, target;
template<>
MoveStack* generate<MV_LEGAL>(const Position& pos, MoveStack* mlist) {
- assert(pos.is_ok());
-
MoveStack *last, *cur = mlist;
- Bitboard pinned = pos.pinned_pieces(pos.side_to_move());
+ Bitboard pinned = pos.pinned_pieces();
last = pos.in_check() ? generate<MV_EVASION>(pos, mlist)
: generate<MV_NON_EVASION>(pos, mlist);