OSDN Git Service

[shogi-server] - Implemented conversion of move representation between CSA format...
[shogi-server/shogi-server.git] / shogi_server / time_clock.rb
index 08258de..6426fda 100644 (file)
@@ -53,6 +53,12 @@ class TimeClock
     return 9999999
   end
 
+  # Returns what "Time_Unit:" in CSA protocol should provide.
+  #
+  def time_unit
+    return "1sec"
+  end
+
   # If thinking time runs out, returns true; false otherwise.
   #
   def timeout?(player, start_time, end_time)
@@ -106,6 +112,10 @@ class StopWatchClock < TimeClock
     super
   end
 
+  def time_unit
+    return "1min"
+  end
+
   def time_duration(start_time, end_time)
     t = [(end_time - start_time).floor, @least_time_per_move].max
     return (t / @byoyomi) * @byoyomi