I am making a game demo where only computers play, but it is way too fast. I need it to show every move.
The program uses a while loop and it doesn’t have anything supporting event listeners.
It just requires computer to make moves.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You could have a background task that triggers the moves and waits appropriately between moves. Something like:
You would need to add a stopping mechanism (via interrupts) and probably sophisticate the logic but the basic idea should work.
Alternatively to sleeping, you could schedule the moves with a Timer every x milliseconds for example. Note that the resolution of Timer is not very good, possibly as high as 30ms, so it might not be precise enough for you need.