How can I set a time limit for a game?
Posted
by
Haoda Fu
on Programmers
See other posts from Programmers
or by Haoda Fu
Published on 2014-08-17T17:36:10Z
Indexed on
2014/08/19
16:29 UTC
Read the original article
Hit count: 287
I am learning the multi-threading and timer in C# now. But it seems I can't find a good solution.
For example, I would like to see how many addition problems that I can solve within 1 min. I would like my program to have
- A digital clock to count for 60 seconds in the top of my Console.
- Print a math problem in the middle of my console wait for my input.
- When 60 seconds is done, stop the math problem challenges immediately (most of time, it is still waiting for my input, but we will stop it immediately).
- Count how many correct problems that I have solved.
Two challenges of the program now.
a) how can we make sure the print time and math problem do not mess up.
b) how can we stop the math challenges part immediately after time is up
© Programmers or respective owner