Sorceress

Guess The Number

Feb 9th, 2020
753
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. NMax = 20
  2. DO
  3.   COLOR 15: CLS
  4.   PRINT "Welome to Guess The Number"
  5.   PRINT "written by sorceress"
  6.   PRINT
  7.   PRINT "Are you ready to play? (y/n)": INPUT a$
  8.   IF a$ = "Y" OR a$ = "y" THEN GOSUB startgame
  9.   IF a$ = "N" OR a$ = "n" THEN GOSUB endgame
  10. LOOP
  11.  
  12. startgame:
  13. RANDOMIZE TIMER
  14. N = INT(RND * NMax + 1)
  15. PRINT
  16. PRINT "I have picked a number between 1 and"; NMax
  17. g = 5
  18. WHILE g > 0
  19.   COLOR 7: PRINT "You have"; g; "guesses!"
  20.   INPUT a$: M = VAL(a$)
  21.   PRINT
  22.   IF M < 1 OR M > NMax THEN
  23.     COLOR 9
  24.     PRINT "You must pick a number between 1 and 20."
  25.   ELSE
  26.     IF M < N THEN COLOR 6: PRINT "Your guess is too low!": g = g - 1
  27.     IF M > N THEN COLOR 6: PRINT "Your guess is too big!": g = g - 1
  28.     IF M = N THEN COLOR 10: PRINT "Yes, that is it! Well done :-)": SLEEP: RETURN
  29.   END IF
  30. WEND
  31. COLOR 12: PRINT "Sorry, you are all out of guesses. My number was"; N
  32. SLEEP
  33. RETURN
  34.  
  35.  
  36. endgame:
  37. PRINT
  38. PRINT "OK. Goodbye"
  39. SLEEP
  40. SYSTEM
RAW Paste Data