Rockerfer Basic - and online basic interpreter
RockerFer Basic home page
declare variable integer secret
declare variable integer guess
declare variable integer count
declare variable string congratulations
declare variable string guess_string
declare variable string playagain
randomize
repeat
secret = int(rnd() * 100)
print "A number guessing game. <1-10 HOT> <11-20 WARM> otherwise COLD')"
count = 0
repeat
print "Guess the secret number <1-100>"
read guess
count = count + 1
if guess <> secret, then
if abs(guess-secret) > 20, then
print "cold"
end if
if abs(guess-secret) < 20 and abs(guess-secret) > 10, then
print "warm"
end if
if abs(guess-secret) < 11, then
print "hot"
end if
end if
until guess = secret
if count = 1, then
guess_string = " guess"
end if
if count > 1, then
guess_string = " guesses"
end if
congratulations = "you got it in " + str(count) + guess_string
print congratulations
print "Play again Y-yes N-no"
read playagain
playagain = left(playagain,1)
until playagain = "N" or playagain = "n"
end
Comments (0)
You don't have permission to comment on this page.