X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fmovegen.cpp;h=5308e45ddfbdd9e6d2dd36f89c8fd91e6c38fa28;hb=9c8c4ff46f87d202b8c9b09c5b51c2b4f81b31d2;hp=7cbd157a75b5a008e6d0f92ae8bfc93f2fcf8366;hpb=d655147e8c528c1bb4632a13c6102599ac1bcc7b;p=stockfish diff --git a/src/movegen.cpp b/src/movegen.cpp index 7cbd157a..5308e45d 100644 --- a/src/movegen.cpp +++ b/src/movegen.cpp @@ -17,19 +17,18 @@ along with this program. If not, see . */ -#include #include +#include #include "bitcount.h" #include "movegen.h" #include "position.h" -#include "misc.h" -// Simple macro to wrap a very common while loop, no facny, no flexibility, -// hardcoded list name 'mlist' and from square 'from'. +/// Simple macro to wrap a very common while loop, no facny, no flexibility, +/// hardcoded names 'mlist' and 'from'. #define SERIALIZE_MOVES(b) while (b) (*mlist++).move = make_move(from, pop_1st_bit(&b)) -// Version used for pawns, where the 'from' square is given as a delta from the 'to' square +/// Version used for pawns, where the 'from' square is given as a delta from the 'to' square #define SERIALIZE_MOVES_D(b, d) while (b) { to = pop_1st_bit(&b); (*mlist++).move = make_move(to + (d), to); } namespace { @@ -139,7 +138,7 @@ namespace { // Knight-promotion is the only one that can give a check (direct or // discovered) not already included in the queen-promotion. - if ( Type == MV_CHECK + if ( Type == MV_NON_CAPTURE_CHECK && bit_is_set(StepAttacksBB[W_KNIGHT][to], ksq)) (*mlist++).move = make_promotion(to - Delta, to, KNIGHT); else @@ -179,13 +178,13 @@ namespace { b1 = move_pawns(pawnsNotOn7) & emptySquares; b2 = move_pawns(b1 & TRank3BB) & emptySquares; - if (Type == MV_EVASION) + if (Type == MV_EVASION) // Consider only blocking squares { - b1 &= target; // Consider only blocking squares + b1 &= target; b2 &= target; } - if (Type == MV_CHECK) + if (Type == MV_NON_CAPTURE_CHECK) { // Consider only direct checks b1 &= pos.attacks_from(ksq, Them); @@ -195,7 +194,7 @@ namespace { // if the pawn is not on the same file as the enemy king, because we // don't generate captures. Note that a possible discovery check // promotion has been already generated among captures. - if (pawnsNotOn7 & target) // For CHECK type target is dc bitboard + if (pawnsNotOn7 & target) // Target is dc bitboard { dc1 = move_pawns(pawnsNotOn7 & target) & emptySquares & ~file_bb(ksq); dc2 = move_pawns(dc1 & TRank3BB) & emptySquares; @@ -288,8 +287,8 @@ namespace { template<> FORCE_INLINE MoveStack* generate_direct_checks(const Position& p, MoveStack* m, Color us, Bitboard dc, Square ksq) { - return (us == WHITE ? generate_pawn_moves(p, m, dc, ksq) - : generate_pawn_moves(p, m, dc, ksq)); + return (us == WHITE ? generate_pawn_moves(p, m, dc, ksq) + : generate_pawn_moves(p, m, dc, ksq)); } @@ -498,7 +497,7 @@ MoveStack* generate(const Position& pos, MoveStack* mlist) { } -/// generate computes a complete list of legal moves in the current position +/// generate generates all legal moves in the current position template<> MoveStack* generate(const Position& pos, MoveStack* mlist) {