Created
July 20, 2011 14:50
-
-
Save melborne/1095106 to your computer and use it in GitHub Desktop.
fib
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
# fib plugin | |
Earthquake.init do | |
fibo = ->m,a=1,b=1 { Enumerator.new { |y| loop{ y << a; a,b = b,a+b } }.take m } | |
command :fib do |m| | |
puts "%d".c(rand(6).+31) % fibo[m[1].to_i].pop | |
end | |
command :fibs do |m| | |
fibs = fibo[m[1].to_i].map { |n| n.to_s.c(rand(6)+31) } | |
print fibs*' ', "\n" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment