• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

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

shogi-server source


Commit MetaInfo

Revisãof4486250c63e92156665bff7b1bcd2c98b6f7e95 (tree)
Hora2013-09-08 11:02:41
AutorDaigo Moriwaki <beatles@user...>
CommiterDaigo Moriwaki

Mensagem de Log

[shogi-server] - shogi_server/{game,time_clock}.rb:

When StopWatchClock is used, "Time_Unit:" of starting messages
in CSA protocol supplies "1min".

Mudança Sumário

Diff

--- a/changelog
+++ b/changelog
@@ -1,3 +1,10 @@
1+2013-09-08 Daigo Moriwaki <daigo at debian dot org>
2+
3+ * [shogi-server]
4+ - shogi_server/{game,time_clock}.rb:
5+ When StopWatchClock is used, "Time_Unit:" of starting messages
6+ in CSA protocol supplies "1min".
7+
18 2013-04-07 Daigo Moriwaki <daigo at debian dot org>
29
310 * [shogi-server]
--- a/shogi_server/game.rb
+++ b/shogi_server/game.rb
@@ -364,7 +364,7 @@ Name-:#{@gote.name}
364364 Rematch_On_Draw:NO
365365 To_Move:+
366366 BEGIN Time
367-Time_Unit:1sec
367+Time_Unit:#{@time_clock.time_unit}
368368 Total_Time:#{@total_time}
369369 Byoyomi:#{@byoyomi}
370370 Least_Time_Per_Move:#{Least_Time_Per_Move}
@@ -398,7 +398,7 @@ Your_Turn:#{sg_flag}
398398 Rematch_On_Draw:NO
399399 To_Move:#{@board.teban ? "+" : "-"}
400400 BEGIN Time
401-Time_Unit:1sec
401+Time_Unit:#{@time_clock.time_unit}
402402 Total_Time:#{@total_time}
403403 Byoyomi:#{@byoyomi}
404404 Least_Time_Per_Move:#{Least_Time_Per_Move}
--- a/shogi_server/time_clock.rb
+++ b/shogi_server/time_clock.rb
@@ -53,6 +53,12 @@ class TimeClock
5353 return 9999999
5454 end
5555
56+ # Returns what "Time_Unit:" in CSA protocol should provide.
57+ #
58+ def time_unit
59+ return "1sec"
60+ end
61+
5662 # If thinking time runs out, returns true; false otherwise.
5763 #
5864 def timeout?(player, start_time, end_time)
@@ -106,6 +112,10 @@ class StopWatchClock < TimeClock
106112 super
107113 end
108114
115+ def time_unit
116+ return "1min"
117+ end
118+
109119 def time_duration(start_time, end_time)
110120 t = [(end_time - start_time).floor, @least_time_per_move].max
111121 return (t / @byoyomi) * @byoyomi