Are you sure it is false? Did you debug it (either with debugger or by printing something in your branches to the console)?
why will it be true?
You have a branch that sets it to true
Why don't just use while (true) and break? You only have single location to break it, no need to use bool variable like that.
I am sure you have just mistakenly walked through your program. In here, there are 2 conditions need to be fulfilled to break the loop: - check_legal_movement() returns true - check_eat() returns false Are you sure about that? Reconsider and simplify it if you can. I think you don't even need nested if for this. Also the legal_move = false; in else block is really useless.
found the mistake. thank you
Обсуждают сегодня