Basically, the challenge is to write the smallest Ruby program that will print the numbers from 1 to 100 except:
* substitute Fizz for numbers that are multiples of 3
* substitute Buzz for numbers that are multiples of 5
* substitute FizzBuzz for numbers that are multiples of both 3 and 5
I think if the substring indices could be computed mathematically instead of logically, it might work, but it's possible an entirely new approach is necessary.
It works correctly, so to see acceptable output, just run it.
Basically, the challenge is to write the smallest Ruby program that will
print the numbers from 1 to 100 except:
* substitute Fizz for numbers that are multiples of 3
* substitute Buzz for numbers that are multiples of 5
* substitute FizzBuzz for numbers that are multiples of both 3 and 5
I think if the substring indices could be computed mathematically
instead of logically, it might work, but it's possible an entirely new
approach is necessary.
It works correctly, so to see acceptable output, just run it.
Basically, the challenge is to write the smallest Ruby program that will
print the numbers from 1 to 100 except:
* substitute Fizz for numbers that are multiples of 3
* substitute Buzz for numbers that are multiples of 5
* substitute FizzBuzz for numbers that are multiples of both 3 and 5
..
Can any Ruby guru out there get it down to 56 bytes?
I submitted the resulting program to the site (which is back up now) under 'comp.lang.ruby' since multiple people contributed. Comes in at 57 bytes - only 1 byte longer than the best. So apparently the site does count the EOF byte.
Interestingly, the following Ruby program (with a little help from sed that my friend passed along) comes in at exactly 56 bytes, but the test site rightfully failed it due to the attempt to shell the command:
I was trying to submit to program for the prime number challenge, but I
can't make it work because I don't understand how does this website do the
input to the submitted programs.
I mean that when I use ARGV or $*, it seems these variables are empty (just
submitting a test program that does a "pp ARGV" outputs an empty array).
Is there anyone who knows how can I get the input for this website ?
This is really bugging me. Someone posted a golf challenge to write a
smallest FizzBuzz program here:
...
Hey! Stop this! It's supposed to be the dreadfull scripting language
called Pearl that's totally unreadable and it's abusers waste the
precious time trying to beat each other by writing something in as few
characters as possible!
Basically, the challenge is to write the smallest Ruby program that will
print the numbers from 1 to 100 except:
* substitute Fizz for numbers that are multiples of 3
* substitute Buzz for numbers that are multiples of 5
* substitute FizzBuzz for numbers that are multiples of both 3 and 5
..
Can any Ruby guru out there get it down to 56 bytes?
Did you try to read from $stdin? I know that is kind of stupid to ask,
but sometimes we do not see what is hidden in front of our eyes
Robert
···
On 3/5/07, Guillaume Nargeot <guillaume.nargeotDONOTFUCKINGSPAM@fusionsystems.co.jp> wrote:
I was trying to submit to program for the prime number challenge, but I
can't make it work because I don't understand how does this website do the
input to the submitted programs.
I mean that when I use ARGV or $*, it seems these variables are empty (just
submitting a test program that does a "pp ARGV" outputs an empty array).
Is there anyone who knows how can I get the input for this website ?
--
We have not succeeded in answering all of our questions.
In fact, in some ways, we are more confused than ever.
But we feel we are confused on a higher level and about more important things.
-Anonymous
Hey! Stop this! It's supposed to be the dreadfull scripting language
called Pearl that's totally unreadable and it's abusers waste the
precious time trying to beat each other by writing something in as few
characters as possible!
And what's pearl? I thought it was perl. What does it mean if one
doesn't know how to properly spell one's favorite language?
You could always tell who was really in the Smalltalk community or at
least who wasn't when they spelled it SmallTalk.
···
On 3/7/07, Martin DeMello <martindemello@gmail.com> wrote:
On 3/7/07, Jenda Krynicky <jenda@cpan.org> wrote:
>
> Hey! Stop this! It's supposed to be the dreadfull scripting language
> called Pearl that's totally unreadable and it's abusers waste the
> precious time trying to beat each other by writing something in as few
> characters as possible!