Use st->gamePly to store fullMoves

This allow to retire do_setup_move() and also to simplify
draw detection logic becuase now we always have:

Min(st->rule50, st->gamePly) = st->rule50

This was already true when starting from starting position,
but now is true even when starting from a FEN string because
now we take in account fullmove number in counting gamePly so
that it is always.

st->rule50 <= st->gamePly

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba
2011-07-20 10:01:12 +02:00
parent 3d8140a541
commit 3185c36a65
4 changed files with 13 additions and 29 deletions

View File

@@ -163,7 +163,6 @@ public:
bool pawn_is_passed(Color c, Square s) const;
// Doing and undoing moves
void do_setup_move(Move m, StateInfo& st);
void do_move(Move m, StateInfo& st);
void do_move(Move m, StateInfo& st, const CheckInfo& ci, bool moveIsCheck);
void undo_move(Move m);
@@ -190,7 +189,7 @@ public:
template<bool SkipRepetition> bool is_draw() const;
// Number of plies from starting position
int startpos_ply_counter() const;
int game_ply() const;
// Other properties of the position
bool opposite_colored_bishops() const;
@@ -257,7 +256,6 @@ private:
StateInfo startState;
int64_t nodes;
Color sideToMove;
int fullMoves;
int threadID;
StateInfo* st;
int chess960;
@@ -423,8 +421,8 @@ inline bool Position::move_is_passed_pawn_push(Move m) const {
&& pawn_is_passed(c, move_to(m));
}
inline int Position::startpos_ply_counter() const {
return Max(2 * (fullMoves - 1), 0) + int(sideToMove == BLACK);
inline int Position::game_ply() const {
return st->gamePly;
}
inline bool Position::opposite_colored_bishops() const {