Create tick() function that runs a game cycle periodically