On 6/1/07, Ruby Quiz <james / grayproductions.net> wrote:
> The three rules of Ruby Quiz:
>
> 1.  Please do not post any solutions or spoiler discussion for this quiz until
> 48 hours have passed from the time on this message.
>
> 2.  Support Ruby Quiz by submitting ideas as often as you can:
>
> http://www.rubyquiz.com/
>
> 3.  Enjoy!
>
> Suggestion:  A [QUIZ] in the subject of emails about the problem helps everyone
> on Ruby Talk follow the discussion.  Please reply to the original quiz message,
> if you can.
>
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>
> There has been some debate on the proper ways to screen programmers you intend
> to hire.  A common theory is that you really need to have the programmer write
> some code for you to accurately gauge their skill.  Exactly what to have them
> write is another debate, but the blogosphere has recently been abuzz with this
> question as a screener:
>
>         Write a program that prints the numbers from 1 to 100.
>         But for multiples of three print "Fizz" instead of the
>         number and for the multiples of five print "Buzz". For
>         numbers which are multiples of both three and five
>         print "FizzBuzz".
>
> Pretend you've just walked into a job interview and been hit with this question.
> Solve it as you would under such circumstances for this week's Ruby Quiz.
>
>

Here is my nice, ungolfed version.  But I took Peter's Extra Credit challenge.

class Integer
  def inspect
    x = (self % 3 == 0 ? "Fizz" : "")
    x << ( self % 5 == 0 ? "Buzz" : "" )
    x.empty? ? self : x
  end
end

(1..100).each {|x| p x}

I did this live in front of a friend, then he tried it in java.  And
Obj-C.  I beat him in time and line count for both.  It was pretty
funny to watch him try.

-- 
Chris Carter
concentrationstudios.com
brynmawrcs.com