shogi-server source
Revisão | e4a84fa22e0db1b48c9cd4efe62549895a1b7133 (tree) |
---|---|
Hora | 2015-12-12 13:09:11 |
Autor | Daigo Moriwaki <daigo@debi...> |
Commiter | Daigo Moriwaki |
Merge branch '201512-timeclock'
@@ -1,3 +1,16 @@ | ||
1 | +2015-11-27 Daigo Moriwaki <daigo at debian dot org> | |
2 | + | |
3 | + * [shogi-server] shogi_server/time_clock.rb: | |
4 | + - A time consumed could be -1. | |
5 | + * The start time of a move is captured after sending a move to a | |
6 | + player of the next turn at the end of the giant lock | |
7 | + * The end time of the move is captured at the exact time when the | |
8 | + server receives it before the giant lock | |
9 | + Therefore, end_time < start_time is possible when a player returns a | |
10 | + move instantly. | |
11 | + Thanks to Tomoyuki Kaneko for reporting this issue. | |
12 | + (Closes: #35795) | |
13 | + | |
1 | 14 | 2015-02-14 Daigo Moriwaki <daigo at debian dot org> |
2 | 15 | |
3 | 16 | * util/statistics.rb: |
@@ -125,11 +125,6 @@ class ChessClockWithLeastZero < ChessClock | ||
125 | 125 | super |
126 | 126 | end |
127 | 127 | |
128 | - def time_duration(mytime, start_time, end_time) | |
129 | - t = end_time - start_time | |
130 | - return t.floor | |
131 | - end | |
132 | - | |
133 | 128 | def to_s |
134 | 129 | return "ChessClockWithLeastZero: LeastTimePerMove %d; TotalTime %d; Byoyomi %d" % [@least_time_per_move, @total_time, @byoyomi] |
135 | 130 | end |
@@ -79,6 +79,8 @@ class TestChessClockWithLeastZero < Test::Unit::TestCase | ||
79 | 79 | assert_equal(1, tc.time_duration(1, 100, 101)) # 1 |
80 | 80 | assert_equal(2, tc.time_duration(100, 100.1, 102.9)) # 2.8 |
81 | 81 | assert_equal(2, tc.time_duration(100, 100, 102)) # 2 |
82 | + | |
83 | + assert_equal(0, tc.time_duration(100, 100, 99.9)) # -0.1 | |
82 | 84 | end |
83 | 85 | |
84 | 86 | def test_time_duration_over_thinking_time |