Microwave time setting

I think this problem boils down to two separate problems.

  • The first is to set the numbers in the sequence you want them to work, even if it prints you 54:65.
  • Once you get there you can maybe try to convert the string to time parameters, then extract the results separately as hour and minutes which you will display on the owen ui and use in your game logic.

The string version of the input would be stored separately for the string operations to input the numbers only, it will be a hidden property you store for further evaluations.

I’m assuming the time conversion operations should correct the invalid 54:65 to the proper 55:05 output for you (never tested, but it usually the behavior of such time conversion libs). The interesting thing comes after all this, since you can expect a little incosistency at this point once you put an additional number to the system, eg a 1, which would result in a 56:51 in instead of the expected 50:51.

What would be your expected time stamp at this point once you press a number 1 after the displayed 55:05 is on the screen?

Maybe you should just avoid the number overwrites go and with a maximum of 4 input digits. You can also provide a Clear button that will reset the timer to 00:00 and the user can input any 4 numbers again. That would make things a bit easier.