added the main loop and a function to check the guess