I am creating a tic tac toe game where i have a condition, that if player does not respond within 5 seconds he loses the game. player responds by clicking a button. Do we have something like this to do?
i tried implementing this by having a list of times when the button was clicked and check whether a new button click happened in the next 5 seconds or not. it works well on the first click but complexities arise when multiple clicks are added.