[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: [QUIZ] FizzBuzz (#126

I. P.

6/2/2007 6:07:00 PM

|William (Bill) Froelich|

WBF> I spent a bunch of time trying to figure out how to output
WBF> those (unsuccessfully) after getting my initial solution working.
WBF> Based on a number of the other posts on the topic it appears that
WBF> the real requirement was to output Fizz, Buzz or FizzBuzz only
WBF> without the other characters. Is that correct?
Yes. Probably this symbols came from non-standard quotation marks.

--
I. P. 2007-06-02T22:08


4 Answers

Sammy Larbi

6/2/2007 7:04:00 PM

0

Sun Park wrote:
> I golf too! :)
> I got to reach 56 bytes, but I highly doubt I can shave one more byte
> from
> it.
>
I can't wait for tomorrow to see how you all got such ridiculously low
numbers =)


Todd Benson

6/2/2007 7:52:00 PM

0

On 6/2/07, Sammy Larbi <sam@powersource.com> wrote:
> Sun Park wrote:
> > I golf too! :)
> > I got to reach 56 bytes, but I highly doubt I can shave one more byte
> > from
> > it.
> >
> I can't wait for tomorrow to see how you all got such ridiculously low
> numbers =)
>
>
>

I'm down to 42 chars.


Just kidding :) The best I could do was 74, and it looks crappy.

Todd

Robert Dober

6/2/2007 7:54:00 PM

0

On 6/2/07, Sun Park <geniusleonid@gmail.com> wrote:
> I golf too! :)
> I got to reach 56 bytes, but I highly doubt I can shave one more byte from
> it.
>
We failed, just look at the achieves, I do not consider that a spoiler
because I am sure James was aware of the Ruby ML community's attempt
to get it to 56 bytes in March if I recall correctly.

And no I guess nobody would golf at a job interview unless it were for
the PGA of course.

Robert


--
You see things; and you say Why?
But I dream things that never were; and I say Why not?
-- George Bernard Shaw

Patrick Hurley

6/2/2007 8:00:00 PM

0

I know at an interview I would start with (well not exactly, but this
makes checking golf results easier)...

pth

require "test/unit"

class TestFizzbuzz < Test::Unit::TestCase
def test_output
assert_equal(CORRECT,`ruby fizzbuzz.rb`)
end
end

CORRECT = <<EOF
1
2
Fizz
4
Buzz
Fizz
7
8
Fizz
Buzz
11
Fizz
13
14
FizzBuzz
16
17
Fizz
19
Buzz
Fizz
22
23
Fizz
Buzz
26
Fizz
28
29
FizzBuzz
31
32
Fizz
34
Buzz
Fizz
37
38
Fizz
Buzz
41
Fizz
43
44
FizzBuzz
46
47
Fizz
49
Buzz
Fizz
52
53
Fizz
Buzz
56
Fizz
58
59
FizzBuzz
61
62
Fizz
64
Buzz
Fizz
67
68
Fizz
Buzz
71
Fizz
73
74
FizzBuzz
76
77
Fizz
79
Buzz
Fizz
82
83
Fizz
Buzz
86
Fizz
88
89
FizzBuzz
91
92
Fizz
94
Buzz
Fizz
97
98
Fizz
Buzz
EOF