0

I'm working on a game (sorta) where you can give numeric answers based on what your hear. As soon as a number gets called this number gets saved.

I require the score mechanism to allow the user to answer the number within a certain given time, the order is hereby unrelated.

For example, the available time is 10 seconds. within those 10 seconds 2 and 4 are mentioned. The player can answer, 2 and 4 in any order. The available response time is ofcourse binded to each individual answer, each answer has those ten seconds lifespan before it gets destroyed.

The logic is that the user must answer the heard sounds. Within a round he can't get any mistake, if a mistake is made the round is failed. If he doesn't response within those 10 seconds or give a wrong number that means a fail. If he gets the answer in time that number is ofcourse removed from the array. This is due to the possibility the same number gets called within the time span, like 2 7's within those 10 seconds, the user requires to hit 7 twice.

How can I make an array (or object based array) to remove each inserted number after 10 seconds after insertion.

Note: all given numbers are examples.

Note: the round info is background information and should not be related to the answer as the round continues and only a counter gets increased (as long as the current round hasn't increased the number already)

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
IMarks
  • 187
  • 11
  • Why you need to remove the numbers from array? – giannisf Feb 29 '16 at 20:04
  • 1
    What are you asking for? code? tutorial? algorithm? – Phantômaxx Feb 29 '16 at 20:06
  • Code or just hints. as far as i could find there are no default unset methods so i believe it must be custom build. however i don't have any clue on how to build it time based (on such short time frame). @giannisf because the answer will be wrong if its given after 30 seconds. Those within the array are valid, those who arent mentioned are likely never mentioned. ofcourse it might be possible that the user answers after 11 seconds and its called failed but that is a accepted error, as there needs to be a line on whats truely called and just a random/wrong insert. – IMarks Feb 29 '16 at 20:24
  • 1
    Well, really easy. Fill an array or a list. Shuffle it. Extract the last item, show it and destroy it. Repeat until you arrive to the first item. But the question itself is off-topic. – Phantômaxx Feb 29 '16 at 20:29
  • its not that simple. if the answer is not given within a certain time frame that should automaticly trigger a fail for that round. so its really needs the time management element. And what do you mean by show it? i hope you understand those number are as answers and shouldn't be shown to the user at any time. only thing he sees is the number of succesful rounds at the end of the game. – IMarks Feb 29 '16 at 20:32
  • Put it inbetween. A simple `CountDownTimer` can be a valid help. – Phantômaxx Feb 29 '16 at 20:33
  • 1
    Thanks, that is the class i have been looking for. I believe i can build it with a `CountDownTimer`. – IMarks Feb 29 '16 at 20:38

0 Answers0