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

Distribute part of first move time to other moves

Passed both short TC:
LLR: 2.97 (-2.94,2.94) [-1.50,4.50]
Total: 18907 W: 3475 L: 3322 D: 12110

And long TC:
LLR: 2.96 (-2.94,2.94) [0.00,6.00]
Total: 19044 W: 2997 L: 2811 D: 13236

bench: 8430785
This commit is contained in:
Leonid Pechenik 2014-02-20 08:38:10 +01:00 committed by Marco Costalba
parent 9fcefb2760
commit b8cfc255d4
3 changed files with 6 additions and 7 deletions

View file

@ -43,7 +43,7 @@ namespace Search {
std::vector<RootMove> RootMoves; std::vector<RootMove> RootMoves;
Position RootPos; Position RootPos;
Color RootColor; Color RootColor;
Time::point SearchTime, IterationTime; Time::point SearchTime;
StateStackPtr SetupStates; StateStackPtr SetupStates;
} }
@ -397,7 +397,7 @@ namespace {
sync_cout << uci_pv(pos, depth, alpha, beta) << sync_endl; sync_cout << uci_pv(pos, depth, alpha, beta) << sync_endl;
} }
IterationTime = Time::now() - SearchTime; Time::point iterationTime = Time::now() - SearchTime;
// If skill levels are enabled and time is up, pick a sub-optimal best move // If skill levels are enabled and time is up, pick a sub-optimal best move
if (skill.enabled() && skill.time_to_pick(depth)) if (skill.enabled() && skill.time_to_pick(depth))
@ -432,7 +432,7 @@ namespace {
// Stop the search if only one legal move is available or all // Stop the search if only one legal move is available or all
// of the available time has been used. // of the available time has been used.
if ( RootMoves.size() == 1 if ( RootMoves.size() == 1
|| IterationTime > TimeMgr.available_time() ) || iterationTime > TimeMgr.available_time() )
stop = true; stop = true;
if (stop) if (stop)
@ -1627,8 +1627,7 @@ void check_time() {
Time::point elapsed = Time::now() - SearchTime; Time::point elapsed = Time::now() - SearchTime;
bool stillAtFirstMove = Signals.firstRootMove bool stillAtFirstMove = Signals.firstRootMove
&& !Signals.failedLowAtRoot && !Signals.failedLowAtRoot
&& elapsed > TimeMgr.available_time() && elapsed > TimeMgr.available_time() * 75 / 100;
&& elapsed > IterationTime * 1.4;
bool noMoreTime = elapsed > TimeMgr.maximum_time() - 2 * TimerThread::Resolution bool noMoreTime = elapsed > TimeMgr.maximum_time() - 2 * TimerThread::Resolution
|| stillAtFirstMove; || stillAtFirstMove;

View file

@ -100,7 +100,7 @@ extern LimitsType Limits;
extern std::vector<RootMove> RootMoves; extern std::vector<RootMove> RootMoves;
extern Position RootPos; extern Position RootPos;
extern Color RootColor; extern Color RootColor;
extern Time::point SearchTime, IterationTime; extern Time::point SearchTime;
extern StateStackPtr SetupStates; extern StateStackPtr SetupStates;
extern void init(); extern void init();

View file

@ -27,7 +27,7 @@ class TimeManager {
public: public:
void init(const Search::LimitsType& limits, int currentPly, Color us); void init(const Search::LimitsType& limits, int currentPly, Color us);
void pv_instability(double bestMoveChanges); void pv_instability(double bestMoveChanges);
int available_time() const { return int(optimumSearchTime * unstablePvFactor * 0.62); } int available_time() const { return int(optimumSearchTime * unstablePvFactor * 0.71); }
int maximum_time() const { return maximumSearchTime; } int maximum_time() const { return maximumSearchTime; }
private: private: