Restore startpos_ply_counter() instead of full_moves()
And pass correct currentPly to TimeManager::init(). This restores old behaviour, in particular now black has a different timing than white becuase is no more: currentPly = 2 * fullMoveNumber; but becomes 2 * (fullMoves - 1) + int(sideToMove == BLACK) No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>sf_2.3.1_base
parent
53ccba8457
commit
ff41b8df76
|
@ -193,7 +193,7 @@ public:
|
|||
template<bool SkipRepetition> bool is_draw() const;
|
||||
|
||||
// Number of plies from starting position
|
||||
int full_moves() const;
|
||||
int startpos_ply_counter() const;
|
||||
|
||||
// Other properties of the position
|
||||
bool opposite_colored_bishops() const;
|
||||
|
@ -428,8 +428,8 @@ inline bool Position::move_is_passed_pawn_push(Move m) const {
|
|||
&& pawn_is_passed(c, move_to(m));
|
||||
}
|
||||
|
||||
inline int Position::full_moves() const {
|
||||
return fullMoves;
|
||||
inline int Position::startpos_ply_counter() const {
|
||||
return Max(2 * (fullMoves - 1), 0) + int(sideToMove == BLACK);
|
||||
}
|
||||
|
||||
inline bool Position::opposite_colored_bishops() const {
|
||||
|
|
|
@ -400,7 +400,7 @@ bool think(Position& pos, const SearchLimits& limits, Move searchMoves[]) {
|
|||
NodesSincePoll = 0;
|
||||
current_search_time(get_system_time());
|
||||
Limits = limits;
|
||||
TimeMgr.init(Limits, pos.full_moves());
|
||||
TimeMgr.init(Limits, pos.startpos_ply_counter());
|
||||
|
||||
// Set output steram in normal or chess960 mode
|
||||
cout << set960(pos.is_chess960());
|
||||
|
|
|
@ -83,7 +83,7 @@ void TimeManager::pv_instability(int curChanges, int prevChanges) {
|
|||
}
|
||||
|
||||
|
||||
void TimeManager::init(const SearchLimits& limits, int fullMoveNumber)
|
||||
void TimeManager::init(const SearchLimits& limits, int currentPly)
|
||||
{
|
||||
/* We support four different kind of time controls:
|
||||
|
||||
|
@ -124,8 +124,8 @@ void TimeManager::init(const SearchLimits& limits, int fullMoveNumber)
|
|||
|
||||
hypMyTime = Max(hypMyTime, 0);
|
||||
|
||||
t1 = minThinkingTime + remaining<OptimumTime>(hypMyTime, hypMTG, fullMoveNumber);
|
||||
t2 = minThinkingTime + remaining<MaxTime>(hypMyTime, hypMTG, fullMoveNumber);
|
||||
t1 = minThinkingTime + remaining<OptimumTime>(hypMyTime, hypMTG, currentPly);
|
||||
t2 = minThinkingTime + remaining<MaxTime>(hypMyTime, hypMTG, currentPly);
|
||||
|
||||
optimumSearchTime = Min(optimumSearchTime, t1);
|
||||
maximumSearchTime = Min(maximumSearchTime, t2);
|
||||
|
@ -142,12 +142,11 @@ void TimeManager::init(const SearchLimits& limits, int fullMoveNumber)
|
|||
namespace {
|
||||
|
||||
template<TimeType T>
|
||||
int remaining(int myTime, int movesToGo, int fullMoveNumber)
|
||||
int remaining(int myTime, int movesToGo, int currentPly)
|
||||
{
|
||||
const float TMaxRatio = (T == OptimumTime ? 1 : MaxRatio);
|
||||
const float TStealRatio = (T == OptimumTime ? 0 : StealRatio);
|
||||
|
||||
int currentPly = 2 * fullMoveNumber;
|
||||
int thisMoveImportance = move_importance(currentPly);
|
||||
int otherMovesImportance = 0;
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ struct SearchLimits;
|
|||
class TimeManager {
|
||||
public:
|
||||
|
||||
void init(const SearchLimits& limits, int fullMoveNumber);
|
||||
void init(const SearchLimits& limits, int currentPly);
|
||||
void pv_instability(int curChanges, int prevChanges);
|
||||
int available_time() const { return optimumSearchTime + unstablePVExtraTime; }
|
||||
int maximum_time() const { return maximumSearchTime; }
|
||||
|
|
Loading…
Reference in New Issue