-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathriddle.rb
67 lines (47 loc) · 1.01 KB
/
riddle.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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
require './ending.rb'
module Riddle
include Ending
def riddle_one
i=0
stop = false
a = [8,8,8,8]
until stop do
puts "incert letter"
case gets.chomp
when "o"
a.insert(1, "O")
a.delete_at(2)
a.insert(2, "O")
a.delete_at(3)
when "l"
a.insert(0, "L")
a.delete_at(1)
when "p"
a.insert(3, "P")
a.delete_at(4)
else
i == 5
end
i += 1
if i == 6
stop = true
puts "** You have lost **"
game_over
end
if
a == ["L","O","O","P"]
stop = true
puts "** You are a winner **"
win_ending
# final_end
end
puts "-----------------------------------------------------"
print a.join
puts
puts
puts "number of tries"
puts i
puts "-----------------------------------------------------"
end
end
end