Jose Carrillo wrote on Tue, Aug 2, 2016 05:46 PM UTC:
No Fergus, I tried it, and didn't work.
I just setup a random position where one King would bare the other, and the other lone King could bare the first on his next move. Based on a quick view of your new code in Shatranj, I expected it to end the game saying that: "Both Kings Bared on Next Move! Game Drawn!", but this didn't happen. The game carried on.
I used a different approach in my Chaturanga Davidson's Variation: (Below is the code for Post-Game 1, for white)
if == 1 count onlylower:
set enemies onlyupper;
if > count #enemies 2:
say Bare King! White Wins!;
won;
elseif == count #enemies 1:
say Both Kings Bared! Game Drawn!;
drawn;
endif;
endif;
if == 1 count onlyupper:
set enemies onlylower;
if >= count #enemies 2:
say Bare King! Black Wins!;
lost;
endif;
endif;
I'm actually allowing the Lone King to play one more move. If he can bare the opponent's King, the game is a draw. If the lone King cannot bare the opponent on the next move, then he automatically losses the game.
No Fergus, I tried it, and didn't work.
I just setup a random position where one King would bare the other, and the other lone King could bare the first on his next move. Based on a quick view of your new code in Shatranj, I expected it to end the game saying that: "Both Kings Bared on Next Move! Game Drawn!", but this didn't happen. The game carried on.
I used a different approach in my Chaturanga Davidson's Variation: (Below is the code for Post-Game 1, for white)
if == 1 count onlylower:
set enemies onlyupper;
if > count #enemies 2:
say Bare King! White Wins!;
won;
elseif == count #enemies 1:
say Both Kings Bared! Game Drawn!;
drawn;
endif;
endif;
if == 1 count onlyupper:
set enemies onlylower;
if >= count #enemies 2:
say Bare King! Black Wins!;
lost;
endif;
endif;
I'm actually allowing the Lone King to play one more move. If he can bare the opponent's King, the game is a draw. If the lone King cannot bare the opponent on the next move, then he automatically losses the game.