Last active
December 12, 2015 08:08
-
-
Save javierg/4741870 to your computer and use it in GitHub Desktop.
Fortuna por moneda stateless
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
class FortuneTellerMachine | |
def initialize | |
@coins = 0 | |
end | |
def start | |
puts "Hola ¿Quiéres saber tu fortuna?" | |
@coins += 1 | |
if @coins == 1 | |
puts "necesito otra moneda, yo quiero moneda." | |
elsif @coins == 2 | |
puts fortune.shuffle.first | |
@coins = 0 | |
else | |
"fortuna por moneda, yo quiero yo quiero moneda" | |
end | |
end | |
def fortune | |
[ | |
"You only need look to your own reflection for inspiration. Because you are Beautiful!", | |
"Rivers need springs.", | |
"Good news from afar may bring you a welcome visitor.", | |
"When all else seems to fail, smile for today and just love someone.", | |
"When you look down, all you see is dirt, so keep looking up.", | |
] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment