Classic programming game and interview trope. Print the numbers from 1 to 100. If the number is a multiple of 3, print fizz instead. If the number is a multiple of 5, print buzz. Should it be divisible by both, print fizzbuzz.
- Simplest - each loop over a range with an if else block
- Trivial - upto loop using the return value from an if else block
- Additive - map over a range using an additive string in place of if else
- Number Theory - uses silly properties of base 10 numbers instead of modulus division
- Cycle - uses Array#cycle to iterate over the multiples of 3 and 5
- Recursive - recurses instead of enumeration and a monkey patch on integer
- Error Handling - uses a begin rescue until loop with custom errors
- RubyGems - no need to re-invent the wheel
- Web Request - fetch fizzbuzz.txt down from a remote url
- Consensus - runs other fizzbuzz scripts and takes the most common answer
- Zip - uses array multiplication, Array#zip, and block call to gsub
Running bundle exec rspec, or just bundle exec guard will test all the files against fizzbuzz.txt
- Generic OOP
- Block Passing or Lambda
- Thread Safe
- Vector Composition
- UnixSocket