X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fmovegen.cpp;h=0056ce384dfff017f45d164d442d746a62649943;hb=f427acbd2787cdf0373d081a3a20019b5eb253c6;hp=6f932cd05de6befd53b89737c5e0aadae1cdb516;hpb=b3545737fa573dec230e5395f36b86a4c1de0510;p=stockfish
diff --git a/src/movegen.cpp b/src/movegen.cpp
index 6f932cd0..0056ce38 100644
--- a/src/movegen.cpp
+++ b/src/movegen.cpp
@@ -17,16 +17,10 @@
along with this program. If not, see .
*/
-
-////
-//// Includes
-////
-
#include
#include "bitcount.h"
#include "movegen.h"
-#include "types.h"
// Simple macro to wrap a very common while loop, no facny, no flexibility,
// hardcoded list name 'mlist' and from square 'from'.
@@ -35,10 +29,6 @@
// 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); }
-////
-//// Local definitions
-////
-
namespace {
enum CastlingSide {
@@ -223,7 +213,7 @@ MoveStack* generate(const Position& pos, MoveStack* mlist)
Color us = pos.side_to_move();
Square ksq = pos.king_square(opposite_color(us));
- assert(pos.piece_on(ksq) == piece_of_color_and_type(opposite_color(us), KING));
+ assert(pos.piece_on(ksq) == make_piece(opposite_color(us), KING));
// Discovered non-capture checks
b = dc = pos.discovered_check_candidates(us);
@@ -267,7 +257,7 @@ MoveStack* generate(const Position& pos, MoveStack* mlist) {
Bitboard checkers = pos.checkers();
Bitboard sliderAttacks = EmptyBoardBB;
- assert(pos.piece_on(ksq) == piece_of_color_and_type(us, KING));
+ assert(pos.piece_on(ksq) == make_piece(us, KING));
assert(checkers);
// Find squares attacked by slider checkers, we will remove
@@ -462,7 +452,7 @@ bool move_is_legal(const Position& pos, const Move m, Bitboard pinned) {
namespace {
- template
+ template
inline Bitboard move_pawns(Bitboard p) {
return Delta == DELTA_N ? p << 8 : Delta == DELTA_S ? p >> 8 :
@@ -470,7 +460,7 @@ namespace {
Delta == DELTA_NW ? p << 7 : Delta == DELTA_SW ? p >> 9 : p;
}
- template
+ template
inline MoveStack* generate_pawn_captures(MoveStack* mlist, Bitboard pawns, Bitboard target) {
const Bitboard TFileABB = (Delta == DELTA_NE || Delta == DELTA_SE ? FileABB : FileHBB);
@@ -484,7 +474,7 @@ namespace {
return mlist;
}
- template
+ template
inline MoveStack* generate_promotions(const Position& pos, MoveStack* mlist, Bitboard pawnsOn7, Bitboard target) {
const Bitboard TFileABB = (Delta == DELTA_NE || Delta == DELTA_SE ? FileABB : FileHBB);
@@ -527,12 +517,12 @@ namespace {
// Calculate our parametrized parameters at compile time, named
// according to the point of view of white side.
- const Color Them = (Us == WHITE ? BLACK : WHITE);
- const Bitboard TRank7BB = (Us == WHITE ? Rank7BB : Rank2BB);
- const Bitboard TRank3BB = (Us == WHITE ? Rank3BB : Rank6BB);
- const SquareDelta TDELTA_N = (Us == WHITE ? DELTA_N : DELTA_S);
- const SquareDelta TDELTA_NE = (Us == WHITE ? DELTA_NE : DELTA_SE);
- const SquareDelta TDELTA_NW = (Us == WHITE ? DELTA_NW : DELTA_SW);
+ const Color Them = (Us == WHITE ? BLACK : WHITE);
+ const Bitboard TRank7BB = (Us == WHITE ? Rank7BB : Rank2BB);
+ const Bitboard TRank3BB = (Us == WHITE ? Rank3BB : Rank6BB);
+ const Square TDELTA_N = (Us == WHITE ? DELTA_N : DELTA_S);
+ const Square TDELTA_NE = (Us == WHITE ? DELTA_NE : DELTA_SE);
+ const Square TDELTA_NW = (Us == WHITE ? DELTA_NW : DELTA_SW);
Square to;
Bitboard b1, b2, dc1, dc2, pawnPushes, emptySquares;
@@ -631,7 +621,7 @@ namespace {
Color them = opposite_color(us);
Square ksq = pos.king_square(us);
- assert(pos.piece_on(ksq) == piece_of_color_and_type(us, KING));
+ assert(pos.piece_on(ksq) == make_piece(us, KING));
Square rsq = (Side == KING_SIDE ? pos.initial_kr_square(us) : pos.initial_qr_square(us));
Square s1 = relative_square(us, Side == KING_SIDE ? SQ_G1 : SQ_C1);
@@ -639,7 +629,7 @@ namespace {
Square s;
bool illegal = false;
- assert(pos.piece_on(rsq) == piece_of_color_and_type(us, ROOK));
+ assert(pos.piece_on(rsq) == make_piece(us, ROOK));
// It is a bit complicated to correctly handle Chess960
for (s = Min(ksq, s1); s <= Max(ksq, s1); s++)
@@ -653,8 +643,8 @@ namespace {
if ( Side == QUEEN_SIDE
&& square_file(rsq) == FILE_B
- && ( pos.piece_on(relative_square(us, SQ_A1)) == piece_of_color_and_type(them, ROOK)
- || pos.piece_on(relative_square(us, SQ_A1)) == piece_of_color_and_type(them, QUEEN)))
+ && ( pos.piece_on(relative_square(us, SQ_A1)) == make_piece(them, ROOK)
+ || pos.piece_on(relative_square(us, SQ_A1)) == make_piece(them, QUEEN)))
illegal = true;
if (!illegal)