created setTimeout function to signal end of game.