88 lines
873 B
Text
88 lines
873 B
Text
rem Hilo number guessing game
|
|
rem compile with FTCBASIC to 704 bytes com program file
|
|
|
|
use time.inc
|
|
use random.inc
|
|
|
|
define try = 0, tries = 0, game = 0
|
|
|
|
gosub systemtime
|
|
|
|
let randseed = loworder
|
|
let randlimit = 100
|
|
|
|
do
|
|
|
|
gosub intro
|
|
gosub play
|
|
gosub continue
|
|
|
|
loop try = 0
|
|
|
|
end
|
|
|
|
sub intro
|
|
|
|
bell
|
|
cls
|
|
print "Hilo game"
|
|
crlf
|
|
|
|
return
|
|
|
|
sub play
|
|
|
|
gosub generaterand
|
|
|
|
+1 rand
|
|
0 tries
|
|
let game = 1
|
|
|
|
print "Guess the number between 1 and 100"
|
|
crlf
|
|
|
|
do
|
|
|
|
+1 tries
|
|
|
|
input try
|
|
crlf
|
|
|
|
if try = rand then
|
|
|
|
let game = 0
|
|
|
|
print "You guessed the number!"
|
|
print "Tries: " \
|
|
print tries
|
|
|
|
endif
|
|
|
|
if game = 1 then
|
|
|
|
if try > rand then
|
|
|
|
print "Try lower..."
|
|
|
|
endif
|
|
|
|
if try < rand then
|
|
|
|
print "Try higher..."
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
crlf
|
|
|
|
loop game = 1
|
|
|
|
return
|
|
|
|
sub continue
|
|
|
|
print "Enter 0 to play again or 1 to EXIT to DOS"
|
|
input try
|
|
|
|
return
|