KirbyDance 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/kirbydance.rb +58 -16
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8876dcbabe8b389a07325710958d2a84feb4bf89
|
4
|
+
data.tar.gz: 9922916a87768b185f377fa1d16f2c207cfa9983
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4352d7dc146d8de020e352289100a67f05a4f9d022c275226bfa7dacadcbcd3234cd91bf208c37e20633b343c858911cd63d9668fc85f706bd9a064663d9848
|
7
|
+
data.tar.gz: 5f3db116508a675ee9453f8520f7b93a020894f8db8ff15d04389d3327d5ea8707a105d2aae27e6f8298ebd984b38d624a72c99b454b4685cef545ad56f617b5
|
data/lib/kirbydance.rb
CHANGED
@@ -1,20 +1,62 @@
|
|
1
|
-
% cat lib/kirbydance
|
2
1
|
class Kirby
|
2
|
+
def self.zzz
|
3
|
+
sleep 0.10
|
4
|
+
end
|
5
|
+
|
3
6
|
def self.dance
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
puts "
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
puts
|
17
|
-
|
18
|
-
|
7
|
+
# Look for 'We da best' and replace with something cooler
|
8
|
+
signature = lambda do |str|
|
9
|
+
if str == 'We da best'
|
10
|
+
return ">>> SWAG <<<"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
# This will be how many times the kirbies dance (10)
|
15
|
+
puts "How many times will Kirby dance for you?"
|
16
|
+
|
17
|
+
rotations = gets.chomp.to_i
|
18
|
+
|
19
|
+
puts rotations
|
20
|
+
|
21
|
+
rotations ||= 5 # In case the user hasn't submitted a number
|
22
|
+
|
23
|
+
dance_moves = [
|
24
|
+
"(>'-')>",
|
25
|
+
" <('-'<)",
|
26
|
+
" (>'-')>",
|
27
|
+
" <('-'<)",
|
28
|
+
" (>'-')>",
|
29
|
+
" <('-'<)",
|
30
|
+
" (>'-')>"
|
31
|
+
]
|
32
|
+
|
33
|
+
num_dance_moves = dance_moves.length
|
34
|
+
|
35
|
+
=begin
|
36
|
+
|
37
|
+
This is where we will find the amount of times the array loops
|
38
|
+
|
39
|
+
Rotations = User Input
|
40
|
+
Length = `dance_moves` Length
|
41
|
+
|
42
|
+
=end
|
43
|
+
|
44
|
+
n = rotations * num_dance_moves * 2 # times 2 for reverse as well
|
45
|
+
|
46
|
+
counter = 0
|
47
|
+
|
48
|
+
n.times do |x|
|
49
|
+
puts dance_moves[counter] + x.to_s
|
50
|
+
zzz()
|
51
|
+
|
52
|
+
counter += 1
|
53
|
+
|
54
|
+
if x % num_dance_moves == 0 && x > 0
|
55
|
+
dance_moves.reverse!
|
56
|
+
counter = 0
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
print signature.call('We da best') unless rotations == 5
|
19
61
|
end
|
20
62
|
end
|