]> git.sesse.net Git - stockfish/commitdiff
Fix startpos_ply_counter() regression
authorMarco Costalba <mcostalba@gmail.com>
Sun, 24 Jul 2011 04:59:16 +0000 (05:59 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Sun, 24 Jul 2011 05:59:14 +0000 (06:59 +0100)
Return the correct number of played plies at the end
of the setup moves. Currently it always returns 0 when
starting from start position, like in real games.

We fix this adding st->pliesFromNull that starts from 0
and is incremented after each setup move and is never
reset in the setup phase but only once search is started.

It is an hack because startpos_ply_counter() will return
different values during the search and is correct only
at the beginning of the search.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/position.h
src/uci.cpp

index a933c3faf6e41f843000730a34839a6fa0ad0627..695ad98db8d9bf157effd8be06bc695effa4477a 100644 (file)
@@ -423,7 +423,7 @@ inline bool Position::move_is_passed_pawn_push(Move m) const {
 }
 
 inline int Position::startpos_ply_counter() const {
-  return startPosPly;
+  return startPosPly + st->pliesFromNull; // HACK
 }
 
 inline bool Position::opposite_colored_bishops() const {
index 813c40f7db08a1774363a07a66564e20a14aee66..4d68c86a04f3263216bfd764f6c4e3e535280e55 100644 (file)
@@ -39,7 +39,7 @@ namespace {
 
   // Keep track of position keys along the setup moves (from start position to the
   // position just before to start searching). This is needed by draw detection
-  // where, due to 50 moves rule, we need to ckeck at most 100 plies back.
+  // where, due to 50 moves rule, we need to check at most 100 plies back.
   StateInfo StateRingBuf[102], *SetupState = StateRingBuf;
 
   // UCIParser is a class for parsing UCI input. The class