X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fposition.h;h=f145249c75051cd50403e550ab23a28576a92ace;hp=64cb349abf4dfd71d40a327b88f0ece334c0ac9a;hb=c9dcda6ac488c0058ebd567e1f52e30b8cd0db20;hpb=e6c9ce635819957bce641a432b0675c5c033631b diff --git a/src/position.h b/src/position.h index 64cb349a..f145249c 100644 --- a/src/position.h +++ b/src/position.h @@ -1,7 +1,7 @@ /* Stockfish, a UCI chess playing engine derived from Glaurung 2.1 Copyright (C) 2004-2008 Tord Romstad (Glaurung author) - Copyright (C) 2008-2013 Marco Costalba, Joona Kiiski, Tord Romstad + Copyright (C) 2008-2014 Marco Costalba, Joona Kiiski, Tord Romstad Stockfish is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -108,7 +108,7 @@ public: // Checking Bitboard checkers() const; Bitboard discovered_check_candidates() const; - Bitboard pinned_pieces(Color toMove) const; + Bitboard pinned_pieces(Color c) const; // Attacks to/from a given square Bitboard attackers_to(Square s) const; @@ -123,7 +123,7 @@ public: bool capture(Move m) const; bool capture_or_promotion(Move m) const; bool gives_check(Move m, const CheckInfo& ci) const; - bool passed_pawn_push(Move m) const; + bool advanced_pawn_push(Move m) const; Piece moved_piece(Move m) const; PieceType captured_piece_type() const; @@ -141,7 +141,7 @@ public: void undo_null_move(); // Static exchange evaluation - int see(Move m, int asymmThreshold = 0) const; + int see(Move m) const; int see_sign(Move m) const; // Accessing hash keys @@ -174,7 +174,7 @@ private: // Helper functions void do_castling(Square kfrom, Square kto, Square rfrom, Square rto); - Bitboard hidden_checkers(Square ksq, Color c, Color toMove) const; + Bitboard hidden_checkers(Color c, Color kingColor) const; void put_piece(Square s, Color c, PieceType pt); void remove_piece(Square s, Color c, PieceType pt); void move_piece(Square from, Square to, Color c, PieceType pt); @@ -315,21 +315,20 @@ inline Bitboard Position::checkers() const { } inline Bitboard Position::discovered_check_candidates() const { - return hidden_checkers(king_square(~sideToMove), sideToMove, sideToMove); + return hidden_checkers(sideToMove, ~sideToMove); } -inline Bitboard Position::pinned_pieces(Color toMove) const { - return hidden_checkers(king_square(toMove), ~toMove, toMove); +inline Bitboard Position::pinned_pieces(Color c) const { + return hidden_checkers(c, c); } inline bool Position::pawn_passed(Color c, Square s) const { return !(pieces(~c, PAWN) & passed_pawn_mask(c, s)); } -inline bool Position::passed_pawn_push(Move m) const { - +inline bool Position::advanced_pawn_push(Move m) const { return type_of(moved_piece(m)) == PAWN - && pawn_passed(sideToMove, to_sq(m)); + && relative_rank(sideToMove, from_sq(m)) > RANK_4; } inline Key Position::key() const { @@ -380,7 +379,7 @@ inline bool Position::is_chess960() const { inline bool Position::capture_or_promotion(Move m) const { assert(is_ok(m)); - return type_of(m) ? type_of(m) != CASTLING : !empty(to_sq(m)); + return type_of(m) != NORMAL ? type_of(m) != CASTLING : !empty(to_sq(m)); } inline bool Position::capture(Move m) const {