SlideShare ist ein Scribd-Unternehmen logo
1 von 2
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} 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)

Weitere ähnliche Inhalte

Was ist angesagt? (10)

Monitoramento ambiental e alertas visuais com Zabbix - 3º Zabbix Meetup do In...
Monitoramento ambiental e alertas visuais com Zabbix - 3º Zabbix Meetup do In...Monitoramento ambiental e alertas visuais com Zabbix - 3º Zabbix Meetup do In...
Monitoramento ambiental e alertas visuais com Zabbix - 3º Zabbix Meetup do In...
 
Node App Start Forever
Node App Start ForeverNode App Start Forever
Node App Start Forever
 
Gitosis on Mac OS X Server
Gitosis on Mac OS X ServerGitosis on Mac OS X Server
Gitosis on Mac OS X Server
 
Do .egg à web
Do .egg à webDo .egg à web
Do .egg à web
 
Make the prompt great again
Make the prompt great againMake the prompt great again
Make the prompt great again
 
Tic tac toe
Tic tac toeTic tac toe
Tic tac toe
 
Gitkata refspec
Gitkata refspecGitkata refspec
Gitkata refspec
 
Glusterfs session #18 intro to fuse and its trade offs
Glusterfs session #18 intro to fuse and its trade offsGlusterfs session #18 intro to fuse and its trade offs
Glusterfs session #18 intro to fuse and its trade offs
 
R で解く FizzBuzz 問題
R で解く FizzBuzz 問題R で解く FizzBuzz 問題
R で解く FizzBuzz 問題
 
Bab 6
Bab 6Bab 6
Bab 6
 

Mehr von Kaoru Maeda

Mehr von Kaoru Maeda (20)

Emacs TypeScript
Emacs TypeScriptEmacs TypeScript
Emacs TypeScript
 
IETF103の話題から (HTML5 Conf 2018)
IETF103の話題から (HTML5 Conf 2018)IETF103の話題から (HTML5 Conf 2018)
IETF103の話題から (HTML5 Conf 2018)
 
IETF102 Report Authorization
IETF102 Report AuthorizationIETF102 Report Authorization
IETF102 Report Authorization
 
IETF97 Update oauth tokbind
IETF97 Update oauth tokbindIETF97 Update oauth tokbind
IETF97 Update oauth tokbind
 
IETF96 Update oauth tokbind
IETF96 Update oauth tokbindIETF96 Update oauth tokbind
IETF96 Update oauth tokbind
 
Ietf95 http2
Ietf95 http2Ietf95 http2
Ietf95 http2
 
http2study 20160423 IETF95 Report
http2study 20160423 IETF95 Reporthttp2study 20160423 IETF95 Report
http2study 20160423 IETF95 Report
 
From an Experience of Vulnerability Reporting
From an Experience of Vulnerability ReportingFrom an Experience of Vulnerability Reporting
From an Experience of Vulnerability Reporting
 
HTTP/2: ぼくたちのWebはどう変わるのか
HTTP/2: ぼくたちのWebはどう変わるのかHTTP/2: ぼくたちのWebはどう変わるのか
HTTP/2: ぼくたちのWebはどう変わるのか
 
IETF93 Prague報告Web関連+QUIC
IETF93 Prague報告Web関連+QUICIETF93 Prague報告Web関連+QUIC
IETF93 Prague報告Web関連+QUIC
 
IETF93プレ勉強会、ARTエリアの歩き方
IETF93プレ勉強会、ARTエリアの歩き方IETF93プレ勉強会、ARTエリアの歩き方
IETF93プレ勉強会、ARTエリアの歩き方
 
Tokbind-fido
Tokbind-fidoTokbind-fido
Tokbind-fido
 
IETF92報告IoT関連
IETF92報告IoT関連IETF92報告IoT関連
IETF92報告IoT関連
 
IETF91報告arcmedia-mcic
IETF91報告arcmedia-mcicIETF91報告arcmedia-mcic
IETF91報告arcmedia-mcic
 
Ietf91報告 httpbis-httpauth
Ietf91報告 httpbis-httpauthIetf91報告 httpbis-httpauth
Ietf91報告 httpbis-httpauth
 
IETF91 Honolulu httpbis WG Report
IETF91 Honolulu httpbis WG ReportIETF91 Honolulu httpbis WG Report
IETF91 Honolulu httpbis WG Report
 
HTTP/2 Local activities in Japan
HTTP/2 Local activities in JapanHTTP/2 Local activities in Japan
HTTP/2 Local activities in Japan
 
IETF90 Web関連WG報告 #isocjp
IETF90 Web関連WG報告 #isocjpIETF90 Web関連WG報告 #isocjp
IETF90 Web関連WG報告 #isocjp
 
IETF90 IoT関連WG報告 #isocjp
IETF90 IoT関連WG報告 #isocjpIETF90 IoT関連WG報告 #isocjp
IETF90 IoT関連WG報告 #isocjp
 
HTTP/2 draft 14 preview and IETF90 httpbis WG Report
HTTP/2 draft 14 preview and IETF90 httpbis WG ReportHTTP/2 draft 14 preview and IETF90 httpbis WG Report
HTTP/2 draft 14 preview and IETF90 httpbis WG Report
 

Kürzlich hochgeladen

Kürzlich hochgeladen (20)

Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 

Fizzbuzz in Complex Plane

  • 1. FizzBuzz in Complex Plane Kaoru Maeda @mad_p Feb. 2013
  • 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)