I made a script which randomizes a number and lets you guess what it is.
It will either tell you your guess is too low or too high depending on what you guessed.
You get unlimited guesses.
To run it, you'll need
Aptana RadRails 2.0.5 or a similar program (which supports ruby of course) to run it.
DownloadOr you could just copy this:
puts 'I\'m thinking of a number between 0 and 100, try to figure it out.'
num=(rand(100)) +1
input = ''
while input.to_i != num
input=gets.chomp
if input.to_i < num
puts 'That\'s too low.'
elsif input.to_i > num
puts 'That\'s too high.'
end
end
puts 'You got the number!'
If someone knows how to convert ruby files to console programs, please tell me.