24 lines
449 B
Text
24 lines
449 B
Text
|
set i to 0
|
||
|
set toGuess to random_int(0, 100)
|
||
|
while 1 do
|
||
|
set guessed to input_number()
|
||
|
if i > 20 then
|
||
|
# do you really want to continue?
|
||
|
break
|
||
|
end
|
||
|
if guessed = toGuess then
|
||
|
# success
|
||
|
print_ascii(83)
|
||
|
break
|
||
|
end
|
||
|
if guessed < toGuess then
|
||
|
# too low
|
||
|
print_ascii(76)
|
||
|
end
|
||
|
if guessed > toGuess then
|
||
|
# too high
|
||
|
print_ascii(72)
|
||
|
end
|
||
|
set i to i+1
|
||
|
end
|