set up main loop and made the game automatically resart after it ends