CLS PRINT " +------------------------------------------+ " PRINT " | | " PRINT " | THINK OF A NUMBER | " PRINT " | | " PRINT " | Try to guess my secret number. | " PRINT " | To help you, I will tell you whether | " PRINT " | each incorrect guess is high or low. | " PRINT " | | " PRINT " +------------------------------------------+ "' RANDOMISE // This makes the choice of numbers different each time REPEAT play_game REPEAT INPUT "Do you want another game (y/n)? " : anothergame$ UNTIL anothergame$ = "n" OR anothergame$ = "y" UNTIL anothergame$ = "n" PRINT "Goodbye" END // ------------------------------------------ Play Game PROC play_game LOCAL my_number, attempts my_number := RND 100 attempts := 0 PRINT'"Okay, IÕve got a number." REPEAT INPUT "Enter your guess: " : guess IF guess < my_number THEN PRINT " Too low..." ELIF guess > my_number THEN PRINT " Too high..." ELSE PRINT " YouÕve got it!" ENDIF attempts := attempts + 1 UNTIL guess = my_number PRINT'score$ (attempts)' ENDPROC play_game // --------------------------------------------- Score FUNC score$ (n%) CASE n% OF WHEN 1 RETURN "Incredible, you guessed it first time!" WHEN 2, 3 RETURN "Amazing, you only took " + STR$ n% + " guesses!" WHEN 4, 5 RETURN "Great, you only took " + STR$ n% + " guesses!" WHEN 6, 7 RETURN "Well done, you got it in " + STR$ n% + " guesses." OTHERWISE RETURN "You took " + STR$ n% + " guesses that time." ENDCASE ENDFUNC score$