This repository was archived by the owner on May 21, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +7
-13
lines changed
Expand file tree Collapse file tree 1 file changed +7
-13
lines changed Original file line number Diff line number Diff line change 2424namespace
2525{
2626
27- static const int32_t SUDDEN_DEATH_DIVISOR = 80 ;
27+ static const int32_t SUDDEN_DEATH_DIVISOR = 25 ;
2828static const double DIVISOR_MAX_RATIO = 2.0 ;
2929static 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
You can’t perform that action at this time.
0 commit comments