FizzBuzz in Complex Plane
Kaoru Maeda
@mad_p
Feb. 2013
FizzBuzz Code Golf in Ruby (Tokyo Ruby Kaigi 10*)
My answer (77 chars):
puts eval($*.join'..').map{|n|%W[FizzBuzz Buzz #{n...
Upcoming SlideShare
Loading in …5
×

Fizzbuzz in Complex Plane

5,028 views
4,908 views

Published on

複素数の偏角取ったらFizzBuzzがキレイに解けた記念に

Published in: Education
2 Comments
10 Likes
Statistics
Notes
No Downloads
Views
Total views
5,028
On SlideShare
0
From Embeds
0
Number of Embeds
489
Actions
Shares
0
Downloads
2
Comments
2
Likes
10
Embeds 0
No embeds

No notes for slide

Fizzbuzz in Complex Plane

  1. 1. FizzBuzz in Complex Plane Kaoru Maeda @mad_p Feb. 2013
  2. 2. FizzBuzz Code Golf in Ruby (Tokyo Ruby Kaigi 10*) My answer (77 chars): puts eval($*.join'..').map{|n|%W[FizzBuzz Buzz #{n} Fizz][((n%3).i-n%5).arg]} Im Select Fizz, Buzz, FizzBuzz, or Number by êarg((nmod3)i - (nmod 5))ú ë û 14 8 2 Buzz 11 5 nmod3 4 13 7 1 10 Fizz 1,2,3 radians 9 3 12 -nmod5 * http://codeiq.hatenablog.com/entry/2013/01/16/002033 6 0 Re FizzBuzz (Luckily, 0.arg == 0 in Ruby)

×