Created
October 23, 2017 10:54
-
-
Save Papillard/c5c67fddd07a8dff1a23d03347a5e468 to your computer and use it in GitHub Desktop.
PMU - Reboot batch #100
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
puts "Bonjour, bienvenue à Longchamp" | |
horses = ["Canaçon", "Sonic", "Belle des vents", "Bad boy"] | |
while true | |
puts "Voici les chevaux sur lesquels tu peux parier" | |
horses.each_with_index do |horse, index| | |
puts "Cheval numéro #{index + 1} - #{horse}" | |
end | |
puts "Sur quel cheval veux-tu parier ? donne ton numero ou tape 'exit' pour arrêter" | |
answer = gets.chomp | |
if answer == "exit" | |
break | |
else | |
index = answer.to_i | |
bet = horses[index - 1] | |
result = horses.shuffle | |
winner = result.first | |
result.each_with_index do |horse, index| | |
horse_number = horses.index(horse) | |
puts "Position #{index + 1} - #{horse} (cheval N#{horse_number + 1})" | |
end | |
if bet == winner | |
puts "Tu décroches le gros lot" | |
else | |
puts "C'est perdu, le vainqueur était #{winner}. Tu veux parier à nouveau ?" | |
end | |
end | |
end | |
puts "A bientôt" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment