$options = {}
$options["least-time-per-move"] = 0
+$options["max-moves"] = 256
def log_message(str)
$stderr.puts str
p1_out = <<EOF
BEGIN Game_Summary
-Protocol_Version:1.1
+Protocol_Version:1.2
Protocol_Mode:Server
Format:Shogi 1.0
Declaration:Jishogi 1.1
Your_Turn:+
Rematch_On_Draw:NO
To_Move:+
+Max_Moves:#{$options["max-moves"]}
BEGIN Time
Time_Unit:1sec
Total_Time:1500
Byoyomi:10
+Increment:0
Least_Time_Per_Move:#{$options["least-time-per-move"]}
END Time
BEGIN Position
p2_out = <<EOF
BEGIN Game_Summary
-Protocol_Version:1.1
+Protocol_Version:1.2
Protocol_Mode:Server
Format:Shogi 1.0
Declaration:Jishogi 1.1
Your_Turn:-
Rematch_On_Draw:NO
To_Move:+
+Max_Moves:#{$options["max-moves"]}
BEGIN Time
Time_Unit:1sec
Total_Time:1500
Byoyomi:10
+Increment:0
Least_Time_Per_Move:#{$options["least-time-per-move"]}
END Time
BEGIN Position
V2
N+p1
N-p2
+'Max_Moves:#{$options["max-moves"]}
+'Least_Time_Per_Move:#{$options["least-time-per-move"]}
$EVENT:#{game.game_id}
P1-KY-KE-GI-KI-OU-KI-GI-KE-KY
P2 * -HI * * * * * -KA *
p1_out = <<EOF
BEGIN Game_Summary
-Protocol_Version:1.1
+Protocol_Version:1.2
Protocol_Mode:Server
Format:Shogi 1.0
Declaration:Jishogi 1.1
Your_Turn:+
Rematch_On_Draw:NO
To_Move:-
+Max_Moves:#{$options["max-moves"]}
BEGIN Time
Time_Unit:1sec
Total_Time:1500
Byoyomi:10
+Increment:0
Least_Time_Per_Move:#{$options["least-time-per-move"]}
END Time
BEGIN Position
p2_out = <<EOF
BEGIN Game_Summary
-Protocol_Version:1.1
+Protocol_Version:1.2
Protocol_Mode:Server
Format:Shogi 1.0
Declaration:Jishogi 1.1
Your_Turn:-
Rematch_On_Draw:NO
To_Move:-
+Max_Moves:#{$options["max-moves"]}
BEGIN Time
Time_Unit:1sec
Total_Time:1500
Byoyomi:10
+Increment:0
Least_Time_Per_Move:#{$options["least-time-per-move"]}
END Time
BEGIN Position
V2
N+p1
N-p2
+'Max_Moves:#{$options["max-moves"]}
+'Least_Time_Per_Move:#{$options["least-time-per-move"]}
$EVENT:#{game.game_id}
P1-KY-KE-GI-KI-OU-KI-GI-KE-KY
P2 * -HI * * * * * -KA *
p1_out = <<EOF
BEGIN Game_Summary
-Protocol_Version:1.1
+Protocol_Version:1.2
Protocol_Mode:Server
Format:Shogi 1.0
Declaration:Jishogi 1.1
Your_Turn:+
Rematch_On_Draw:NO
To_Move:+
+Max_Moves:#{$options["max-moves"]}
BEGIN Time
Time_Unit:1sec
Total_Time:1500
Byoyomi:10
+Increment:0
Least_Time_Per_Move:#{$options["least-time-per-move"]}
END Time
BEGIN Position
p2_out = <<EOF
BEGIN Game_Summary
-Protocol_Version:1.1
+Protocol_Version:1.2
Protocol_Mode:Server
Format:Shogi 1.0
Declaration:Jishogi 1.1
Your_Turn:-
Rematch_On_Draw:NO
To_Move:+
+Max_Moves:#{$options["max-moves"]}
BEGIN Time
Time_Unit:1sec
Total_Time:1500
Byoyomi:10
+Increment:0
Least_Time_Per_Move:#{$options["least-time-per-move"]}
END Time
BEGIN Position
V2
N+p1
N-p2
+'Max_Moves:#{$options["max-moves"]}
+'Least_Time_Per_Move:#{$options["least-time-per-move"]}
$EVENT:#{game.game_id}
P1-KY-KE-GI-KI-OU-KI-GI-KE-KY
P2 * -HI * * * * * -KA *