hilo.b 940 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. 1 ' $Source$
  2. 2 ' $State$
  3. 3 ' $Revision$
  4. 10 print "Hi there! I'm written in Basic. Before we start, what is your name?"
  5. 20 input "> ", PlayerName$
  6. 30 print
  7. 40 print "Hello, "; PlayerName$; "!"
  8. 100 gosub 1000
  9. 110 print
  10. 120 print "Would you like another go?"
  11. 130 input "> ", s$
  12. 140 s$ = left$(s$, 1)
  13. 150 if s$ = "n" or s$ = "N" then goto 200
  14. 160 print
  15. 170 print "Excellent! ";
  16. 180 goto 100
  17. 200 print
  18. 210 print "Thanks for playing --- goodbye!"
  19. 220 end
  20. 1000 print "See if you can guess my number."
  21. 1010 Number% = rnd(1) mod 100
  22. 1020 Attempts% = 1
  23. 1030 print
  24. 1040 input "> ", guess%
  25. 1050 if guess% < Number% then print: print "Try a bit higher."
  26. 1060 if guess% > Number% then print: print "Try a bit lower."
  27. 1070 if guess% = Number% then goto 1100
  28. 1080 Attempts% = Attempts% + 1
  29. 1090 goto 1030
  30. 1100 print
  31. 1110 print "You got it right in only"; Attempts%;
  32. 1120 if Attempts% = 1 then print "go"; else print "goes";
  33. 1130 print "!"
  34. 1140 return