OSDN Git Service

Corrected namespace of GSL::Vector. This line is not reached, though.
[shogi-server/shogi-server.git] / shogi_server / game.rb
index 5e46e12..ee90d52 100644 (file)
@@ -32,9 +32,11 @@ class Game
   @@mutex = Mutex.new
   @@time  = 0
 
   @@mutex = Mutex.new
   @@time  = 0
 
-  # Decide turns of players according to their turn preferences.
+  # Decide an actual turn of each player according to their turn preferences.
   # p2 is a rival player of the p1 player.
   # p1_sente_string must be "*", "+" or "-".
   # p2 is a rival player of the p1 player.
   # p1_sente_string must be "*", "+" or "-".
+  # After this call, the sente value of each player is always true or false, not
+  # nil.
   #
   def Game.decide_turns(p1, p1_sente_string, p2)
     if ((p1_sente_string == "*") && (p2.sente == nil))
   #
   def Game.decide_turns(p1, p1_sente_string, p2)
     if ((p1_sente_string == "*") && (p2.sente == nil))
@@ -321,18 +323,7 @@ class Game
 
     now = Time.now.strftime("%Y/%m/%d %H:%M:%S")
     @fh.puts("$START_TIME:#{now}")
 
     now = Time.now.strftime("%Y/%m/%d %H:%M:%S")
     @fh.puts("$START_TIME:#{now}")
-    @fh.print <<EOM
-P1-KY-KE-GI-KI-OU-KI-GI-KE-KY
-P2 * -HI *  *  *  *  * -KA * 
-P3-FU-FU-FU-FU-FU-FU-FU-FU-FU
-P4 *  *  *  *  *  *  *  *  * 
-P5 *  *  *  *  *  *  *  *  * 
-P6 *  *  *  *  *  *  *  *  * 
-P7+FU+FU+FU+FU+FU+FU+FU+FU+FU
-P8 * +KA *  *  *  *  * +HI * 
-P9+KY+KE+GI+KI+OU+KI+GI+KE+KY
-+
-EOM
+    @fh.print(@board.initial_string)
     if rated?
       black_name = @sente.rated? ? @sente.player_id : @sente.name
       white_name = @gote.rated?  ? @gote.player_id  : @gote.name
     if rated?
       black_name = @sente.rated? ? @sente.player_id : @sente.name
       white_name = @gote.rated?  ? @gote.player_id  : @gote.name
@@ -400,7 +391,7 @@ Byoyomi:#{@byoyomi}
 Least_Time_Per_Move:#{Least_Time_Per_Move}
 END Time
 BEGIN Position
 Least_Time_Per_Move:#{Least_Time_Per_Move}
 END Time
 BEGIN Position
-#{Board::INITIAL_POSITION}
+#{@board.initial_string.chomp}
 #{@board.initial_moves.collect {|m| m + ",T1"}.join("\n")}
 END Position
 END Game_Summary
 #{@board.initial_moves.collect {|m| m + ",T1"}.join("\n")}
 END Position
 END Game_Summary