Last active
August 29, 2015 14:05
-
-
Save PifyZ/ec05f49d0f54782a6df5 to your computer and use it in GitHub Desktop.
Plus ou moins (Bootmonkey)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use stdio as io | |
use math | |
Num main(List<Str> args) { | |
Num nb_rand = math.rand(0, 100) | |
Num saisie = -1 | |
Num nb_essais = 0 | |
do { | |
saisie = io.ask("Essai n#{nb_essais + 1} = ").to_num() | |
nb_essais++ | |
if saisie > nb_rand { | |
io.write("C'est moins.\n") | |
} | |
if saisie < nb_rand { | |
io.write("C'est plus.\n") | |
} | |
} while saisie <> nb_rand | |
io.write("Victoire ! En #{nb_essais} essais.") | |
return 0 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment