• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

shogi-server source


Commit MetaInfo

修訂7499643a877678403aff293b55568ecf25130ab5 (tree)
時間2015-01-17 09:39:29
作者Daigo Moriwaki <daigo@debi...>
CommiterDaigo Moriwaki

Log Message

Refactor ChessClockWithLeastZero

Change Summary

差異

--- a/shogi_server/time_clock.rb
+++ b/shogi_server/time_clock.rb
@@ -127,19 +127,7 @@ class ChessClockWithLeastZero < ChessClock
127127
128128 def time_duration(mytime, start_time, end_time)
129129 t = end_time - start_time
130- if @byoyomi > 0
131- # If the remaining thinking time covers the duration t, floor it.
132- if mytime + @byoyomi - t > 0
133- t = t.floor
134- else
135- t = t.ceil
136- end
137- else
138- # Thinking time only
139- t = t.floor
140- end
141-
142- return t
130+ return t.floor
143131 end
144132
145133 def to_s
--- a/test/TC_time_clock.rb
+++ b/test/TC_time_clock.rb
@@ -76,7 +76,7 @@ class TestChessClockWithLeastZero < Test::Unit::TestCase
7676 assert_equal(0, tc.time_duration(100, 100.1, 100.9)) # 0.8
7777 assert_equal(1, tc.time_duration(100, 100, 101)) # 1
7878 assert_equal(1, tc.time_duration(100, 100.1, 101.9)) # 1.8
79- assert_equal(1, tc.time_duration(1, 100, 101)) # 1
79+ assert_equal(1, tc.time_duration(1, 100, 101)) # 1
8080 assert_equal(2, tc.time_duration(100, 100.1, 102.9)) # 2.8
8181 assert_equal(2, tc.time_duration(100, 100, 102)) # 2
8282 end