+2010-09-04 Daigo Moriwaki <daigo at debian dot org>
+
+ * [shogi-server]
+ - shogi_server/board.rb, shogi_server/game.rb: The Buoy behaivor
+ is changed.
+ + Starting a buoy game, players are notified a starting game
+ position with the initial position and moves, instread of a
+ targeting position.
+
2010-08-05 Daigo Moriwaki <daigo at debian dot org>
* [shogi-server]
class Board
+ # Initial board setup.
+ # The string ends with '+', not a line break.
+ #
+ INITIAL_POSITION = (<<-EOF).chomp
+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
++
+EOF
+
# Split a moves line into an array of a move string.
# If it fails to parse the moves, it raises WrongMoves.
# @param moves a moves line. Ex. "+776FU-3334Fu"
return ret
end
+
def initialize(move_count=0)
@sente_hands = Array::new
@gote_hands = Array::new
Least_Time_Per_Move:#{Least_Time_Per_Move}
END Time
BEGIN Position
-#{@board.to_s.chomp}
+#{Board::INITIAL_POSITION}
+#{@board.initial_moves.collect {|m| m + ",T1"}.join("\n")}
END Position
END Game_Summary
EOM
- return str
+ # An empty @board.initial_moves causes an empty line, which should be
+ # eliminated.
+ return str.gsub("\n\n", "\n")
end
def prepared_expire?
P3-FU-FU-FU-FU-FU-FU-FU-FU-FU
P4 * * * * * * * * *
P5 * * * * * * * * *
-P6 * * +FU * * * * * *
-P7+FU+FU * +FU+FU+FU+FU+FU+FU
+P6 * * * * * * * * *
+P7+FU+FU+FU+FU+FU+FU+FU+FU+FU
P8 * +KA * * * * * +HI *
P9+KY+KE+GI+KI+OU+KI+GI+KE+KY
--
++
++7776FU,T1
END Position
END Game_Summary
EOF
P3-FU-FU-FU-FU-FU-FU-FU-FU-FU
P4 * * * * * * * * *
P5 * * * * * * * * *
-P6 * * +FU * * * * * *
-P7+FU+FU * +FU+FU+FU+FU+FU+FU
+P6 * * * * * * * * *
+P7+FU+FU+FU+FU+FU+FU+FU+FU+FU
P8 * +KA * * * * * +HI *
P9+KY+KE+GI+KI+OU+KI+GI+KE+KY
--
++
++7776FU,T1
END Position
END Game_Summary
EOF
BEGIN Position
P1-KY-KE-GI-KI-OU-KI-GI-KE-KY
P2 * -HI * * * * * -KA *
-P3-FU-FU-FU-FU-FU-FU * -FU-FU
-P4 * * * * * * -FU * *
+P3-FU-FU-FU-FU-FU-FU-FU-FU-FU
+P4 * * * * * * * * *
P5 * * * * * * * * *
-P6 * * +FU * * * * * *
-P7+FU+FU * +FU+FU+FU+FU+FU+FU
+P6 * * * * * * * * *
+P7+FU+FU+FU+FU+FU+FU+FU+FU+FU
P8 * +KA * * * * * +HI *
P9+KY+KE+GI+KI+OU+KI+GI+KE+KY
+
++7776FU,T1
+-3334FU,T1
END Position
END Game_Summary
EOF
BEGIN Position
P1-KY-KE-GI-KI-OU-KI-GI-KE-KY
P2 * -HI * * * * * -KA *
-P3-FU-FU-FU-FU-FU-FU * -FU-FU
-P4 * * * * * * -FU * *
+P3-FU-FU-FU-FU-FU-FU-FU-FU-FU
+P4 * * * * * * * * *
P5 * * * * * * * * *
-P6 * * +FU * * * * * *
-P7+FU+FU * +FU+FU+FU+FU+FU+FU
+P6 * * * * * * * * *
+P7+FU+FU+FU+FU+FU+FU+FU+FU+FU
P8 * +KA * * * * * +HI *
P9+KY+KE+GI+KI+OU+KI+GI+KE+KY
+
++7776FU,T1
+-3334FU,T1
END Position
END Game_Summary
EOF