-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path5.rb
26 lines (25 loc) · 805 Bytes
/
5.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
class Magic_ball
@@answers = ['It is certain', 'It is decidedly so', 'Without a doubt',
'Yes - definitely', 'You may rely on it', 'As I see it, yes',
'Most likely', 'Outlook good', 'Signs point to yes', 'Yes',
'Reply hazy, try again', 'Ask again later', 'Better not tell you now',
'Cannot predict now', 'Concentrate and ask again', "Don't count on it",
'My reply is no', 'My sources say no', 'Outlook not so good', 'Very doubtful']
def initialize
@ask = ''
end
def shake(ask)
p 'Thinking...'
sleep 3
@ask = ask
if @ask != ''
p @@answers[rand(@@answers.length - 1)]
else
p "You don't enter your question"
end
end
end
p 'Ask magic ball what you want'
ask = gets.chomp
a = Magic_ball.new
a.shake(ask)