Skip to content
This repository was archived by the owner on May 21, 2022. It is now read-only.

Commit 3552345

Browse files
committed
Re-tuned time control
1 parent a809fd4 commit 3552345

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

timeallocator.cpp

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@
2424
namespace
2525
{
2626

27-
static const int32_t SUDDEN_DEATH_DIVISOR = 80;
27+
static const int32_t SUDDEN_DEATH_DIVISOR = 25;
2828
static const double DIVISOR_MAX_RATIO = 2.0;
2929
static const double MIN_TIME_PER_MOVE = 0.0;
3030

3131
// this number controls how much more time it uses in the beginning vs the end
3232
// higher number means more time in the beginning
33-
static const double TIME_SCALE = 2.0f;
33+
static const double DIVISOR_SCALE = 0.5f;
3434

3535
}
3636

@@ -49,23 +49,17 @@ Search::TimeAllocation AllocateTime(const ChessClock &cc)
4949

5050
if (divisor == 0)
5151
{
52-
// sudden death mode
52+
// sudden death mode (with or without increments)
5353
divisor = SUDDEN_DEATH_DIVISOR;
5454
}
55+
else if ((divisor * DIVISOR_SCALE) > 2) // period mode (with or without increments)
56+
{
57+
divisor *= DIVISOR_SCALE;
58+
}
5559

5660
tAlloc.normalTime = (cc.GetInc() + cc.GetReading() / divisor);
5761
tAlloc.maxTime = cc.GetInc() + cc.GetReading() / divisor * DIVISOR_MAX_RATIO;
5862

59-
if ((tAlloc.normalTime * TIME_SCALE) < (cc.GetReading() / 3.0f))
60-
{
61-
tAlloc.normalTime *= TIME_SCALE;
62-
63-
if ((tAlloc.maxTime * TIME_SCALE) < (cc.GetReading() / 3.0f))
64-
{
65-
tAlloc.maxTime *= TIME_SCALE;
66-
}
67-
}
68-
6963
tAlloc.normalTime = std::max(tAlloc.normalTime, MIN_TIME_PER_MOVE);
7064
tAlloc.maxTime = std::max(tAlloc.maxTime, MIN_TIME_PER_MOVE);
7165

0 commit comments

Comments
 (0)