Skip to content

Commit b2aa903

Browse files
reduce uselessly large safety margin in game timer
1 parent e5408ab commit b2aa903

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

game_timer.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,25 @@ import (
1919
const (
2020
AVG_MOVES_PER_GAME = 55
2121
MIN_MOVES_REMAINING = 15
22-
MAX_TIME = time.Duration(8) * time.Hour // default search time limit
23-
SAFETY_MARGIN = time.Duration(500) * time.Millisecond // minimal amount of time to keep on clock
22+
MAX_TIME = time.Duration(8) * time.Hour // default search time limit
23+
SAFETY_MARGIN = time.Duration(5) * time.Millisecond // minimal amount of time to keep on clock
2424
)
2525

2626
type GameTimer struct {
27-
inc [2]time.Duration
28-
remaining [2]time.Duration
27+
inc [2]time.Duration
28+
remaining [2]time.Duration
2929
movesRemaining int
3030
startTime time.Time
31-
timer *time.Timer
32-
s *Search
33-
sideToMove uint8
31+
timer *time.Timer
32+
s *Search
33+
sideToMove uint8
3434
}
3535

3636
func NewGameTimer(movesPlayed int, sideToMove uint8) *GameTimer {
3737
return &GameTimer{
3838
movesRemaining: max(MIN_MOVES_REMAINING, AVG_MOVES_PER_GAME-movesPlayed),
39-
remaining: [2]time.Duration{MAX_TIME, MAX_TIME},
40-
sideToMove: sideToMove,
39+
remaining: [2]time.Duration{MAX_TIME, MAX_TIME},
40+
sideToMove: sideToMove,
4141
startTime: time.Now(),
4242
}
4343
}

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515
"github.com/pkg/profile"
1616
)
1717

18-
var version = "0.2.1"
18+
var version = "0.2.2"
1919

2020
func max(a, b int) int {
2121
if a > b {

0 commit comments

Comments
 (0)