1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-07-11 19:49:14 +00:00

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>
This commit is contained in:
Marco Costalba 2011-07-02 16:15:20 +01:00
parent 53ccba8457
commit ff41b8df76
4 changed files with 9 additions and 10 deletions

View file

@ -193,7 +193,7 @@ public:
template<bool SkipRepetition> bool is_draw() const; template<bool SkipRepetition> bool is_draw() const;
// Number of plies from starting position // Number of plies from starting position
int full_moves() const; int startpos_ply_counter() const;
// Other properties of the position // Other properties of the position
bool opposite_colored_bishops() const; 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)); && pawn_is_passed(c, move_to(m));
} }
inline int Position::full_moves() const { inline int Position::startpos_ply_counter() const {
return fullMoves; return Max(2 * (fullMoves - 1), 0) + int(sideToMove == BLACK);
} }
inline bool Position::opposite_colored_bishops() const { inline bool Position::opposite_colored_bishops() const {

View file

@ -400,7 +400,7 @@ bool think(Position& pos, const SearchLimits& limits, Move searchMoves[]) {
NodesSincePoll = 0; NodesSincePoll = 0;
current_search_time(get_system_time()); current_search_time(get_system_time());
Limits = limits; Limits = limits;
TimeMgr.init(Limits, pos.full_moves()); TimeMgr.init(Limits, pos.startpos_ply_counter());
// Set output steram in normal or chess960 mode // Set output steram in normal or chess960 mode
cout << set960(pos.is_chess960()); cout << set960(pos.is_chess960());

View file

@ -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: /* We support four different kind of time controls:
@ -124,8 +124,8 @@ void TimeManager::init(const SearchLimits& limits, int fullMoveNumber)
hypMyTime = Max(hypMyTime, 0); hypMyTime = Max(hypMyTime, 0);
t1 = minThinkingTime + remaining<OptimumTime>(hypMyTime, hypMTG, fullMoveNumber); t1 = minThinkingTime + remaining<OptimumTime>(hypMyTime, hypMTG, currentPly);
t2 = minThinkingTime + remaining<MaxTime>(hypMyTime, hypMTG, fullMoveNumber); t2 = minThinkingTime + remaining<MaxTime>(hypMyTime, hypMTG, currentPly);
optimumSearchTime = Min(optimumSearchTime, t1); optimumSearchTime = Min(optimumSearchTime, t1);
maximumSearchTime = Min(maximumSearchTime, t2); maximumSearchTime = Min(maximumSearchTime, t2);
@ -142,12 +142,11 @@ void TimeManager::init(const SearchLimits& limits, int fullMoveNumber)
namespace { namespace {
template<TimeType T> 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 TMaxRatio = (T == OptimumTime ? 1 : MaxRatio);
const float TStealRatio = (T == OptimumTime ? 0 : StealRatio); const float TStealRatio = (T == OptimumTime ? 0 : StealRatio);
int currentPly = 2 * fullMoveNumber;
int thisMoveImportance = move_importance(currentPly); int thisMoveImportance = move_importance(currentPly);
int otherMovesImportance = 0; int otherMovesImportance = 0;

View file

@ -25,7 +25,7 @@ struct SearchLimits;
class TimeManager { class TimeManager {
public: public:
void init(const SearchLimits& limits, int fullMoveNumber); void init(const SearchLimits& limits, int currentPly);
void pv_instability(int curChanges, int prevChanges); void pv_instability(int curChanges, int prevChanges);
int available_time() const { return optimumSearchTime + unstablePVExtraTime; } int available_time() const { return optimumSearchTime + unstablePVExtraTime; }
int maximum_time() const { return maximumSearchTime; } int maximum_time() const { return maximumSearchTime; }