Two kings ends game

This commit is contained in:
retu2libc 2024-02-21 01:20:20 -05:00
parent 451fddb9eb
commit d26f67edf1

View file

@ -664,18 +664,25 @@ I64 MoveCnt(GameState *state)
{ {
I64 i, res = 0, mv_cnt; I64 i, res = 0, mv_cnt;
Move mvs[32]; Move mvs[32];
Bool king_stalemate = TRUE;
for (i = 0; i < 32; i++) for (i = 0; i < 32; i++)
{
if (state->pieces[i].player == state->cur_player) if (state->pieces[i].player == state->cur_player)
{ {
mv_cnt = PieceMoves(state, i, mvs); mv_cnt = PieceMoves(state, i, mvs);
mv_cnt = ChkPieceMoves(state, i, mvs,mv_cnt); mv_cnt = ChkPieceMoves(state, i, mvs,mv_cnt);
res += mv_cnt; res += mv_cnt;
} }
if (state->pieces[i].type != P_KING && state->pieces[i].player >= 0)
king_stalemate = FALSE;
}
if (king_stalemate)
return 0;
else
return res; return res;
} }
U0 DrawIt(CTask *task, CDC *dc) U0 DrawIt(CTask *task, CDC *dc)
{ {
I64 i, x, y, z, k0, k1; I64 i, x, y, z, k0, k1;