Ask coding questions

← Back to all posts
Chess
technol (1)

Need help completing the game ending sequence....... i dont know what to do :shrug_emoji:

Comments
hotnewtop
xxpertHacker (931)

@EpicGamer007 Iirc, you posted a game of chess to Repl talk before, do you think you could help OP here?

EpicGamer007 (1755)

@xxpertHacker i might, i have not peeked at the code however what I did was:

  • Every single move:

    • For both kings
      • Check if the king does not have a place to move, check cannot be blocked, or attacker can not be removed.
        • If all those are true (all the conditions of checkmate are met) game is over.

However it seems that this person is ending the game with a capture of the king, this would probably be much simpler. looping through all the game objects and checking if the king is gone, however, I do not know what the current implementation is so this may not work for OP.

xxpertHacker (931)

Can you elaborate on what you don't know what to do, or in particular, why you don't?

Can you describe the sequence that should occur, and what difficulty you encountered when writing the corresponding code?

technol (1)

@xxpertHacker
the problem that i am facing is that, even if the king of the opposing team has been killed, the game doesnt end, and im not really good with big projects so i miss stuff here and there

xxpertHacker (931)

@technol Do you have any guess as to where the relevant section of code is?