Guess the number/With feedback: Difference between revisions

Content added Content deleted
Line 1,030: Line 1,030:
</pre>
</pre>


=={{header|Tiny Craft Basic}}==
=={{header|Craft Basic}}==
<syntaxhighlight lang="basic">10 cls
<syntaxhighlight lang="basic">title "hilo"


20 let r = int: (rnd) * 100 + 1
let r = int: (rnd) * 100 + 1


30 print "hilo game"
print "hilo game"
40 print "guess the nusmber between 1 and 100"
print "guess the number between 1 and 100"


50 rem loop
label loop


60 let t = t + 1
let t = t + 1


70 input "guess: ", g
input "Guess", g


80 if g <> r then 110
if g = r then


90 print "you guessed it in ", t ," tries."
alert "you guessed it in ", t ," tries."
end
100 goto 220


110 rem endif
endif


120 if g > r or g < 1 then 140
if g >= 1 and g <= 100 then


130 print "too low"
if g < r then


alert "too low"
140 rem endif


endif
150 if g < r or g > 100 then 170


160 print "too high"
if g > r then


alert "too high"
170 rem endif


endif
180 if g >= 1 and g <= 100 then 200


endif
190 print "invalid guess"


if g < 1 or g > 100 then
200 rem endif


alert "invalid guess"
210 if g <> r then 50


endif
220 shell "pause"</syntaxhighlight>

if g <> r then loop</syntaxhighlight>


=={{header|Crystal}}==
=={{header|Crystal}}==