- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
The cornify was really easy to find. But I find myself incapable of understanding WTF the "source code" is supposed to mean.
Admin
I think the candidate was trying to find a repeating sequence in the FizzBuzz output, somehow. But your guess is as good as mine…
Admin
But one thing is sure: he hasn't yet come across the modulo operator.
As for the interface / abstract thing: I'm not sure if all languages know the concept of "abstract" so mybe he can be excused there.
Admin
You don't even need modulo in C++.
Admin
http://blog.codinghorror.com/why-cant-programmers-program/
Failing a FizzBuzz isn't rare. Failing a FizzBuzz this hard, is.
Admin
I need to get back into programming C++...
Hm. Perhaps that function was what he was trying to build in his code snippet?
Edit: fixed broken quoting.
Admin
Likes thread makes more sense now.
Admin
I can't read any of the writing. But I probably wouldn't understand it anyway.
Admin
Instead of dividing and remultiplying, C has a standard reference function called "div". It's perfect for people who are annoyed at the idea of needlessly doing an expensive division twice :
Of course, if he doesn't know % he won't know about standard C functions. In fact, I'm wondering what this guy actually does know.
Admin
Admin
This also is a valid approach at FizzBuzz:
You get my meaning. But would you hire somebody that presented that solution?
Admin
The programmer moved to India and became a project manager.
Admin
If they wrote a script to output that program, then maybe. Just for curiosity's sake.
Admin
Even better: A program that creates that program, compiles it, and runs it.
Admin
I was just joking. Why stop at replacing modulo? Perhaps even better: write an enterprise framework, with separate servers for fizz and buzz, which of course have to be synchronized in some devious way. Ah, the possibilities.
Admin
?
Admin
Admin
https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpriseEdition
Admin
That's what I had in mind. I was too lazy to google it, though.
Admin
The article code looks a lot easier to figure out.
Admin
We don't need no steenking modulo operator.
int i, f, b; for (i=1, f=1, b=1; i<=100; i++, f++, b++) { ; if (f==3) f=0; ; if (b==5) b=0; ; if (!(f+b)) printf("fizzbuzz\n"); ; else if (!f) printf("fizz\n"); ; else if (!b) printf("buzz\n"); ; else printf("%d\n", i); }
Admin
The RWTF is that his code would stop at 100
Admin
It was already posted in a different thread. But now I re-posted it in a timely manner and got all the likes for myself. Today likes, tomorrow the world! MWHAHAHAHA!
Admin
Admin
I seriously fear this person has some kind of brain tumor or medical condition.
Admin
Allow me to translate for you:
Admin
Article source nit:
Note the lack of a space before the
width
attribute.Admin
If I wanted to nitpick, I’d probably complain about the unescaped << in the title attribute first...
Admin
And recursion. (or stinking goto).
Admin
Admin
Should this be categorized as Code SOD or Tales From the Interview? I struggle to call that "code" in the usual sense of the word.
Admin
The guy thought it was code on some level.
This is special however, on so many levels.
Admin
This candidate should write code for feature films instead. It looks awesome and science-y on paper and makes no sense whatsoever; perfect for Hollywood.
Admin
It sorta sits at the intersection of both.
Admin
Admin
No, but if they knew about loop unrolling and mentioned or implemented it as a solution to not require modulo, I'd consider them. Then I'd change the question so they no longer knew the numbers to fizz and buzz on (they would become parameters), requiring them to show modulo or equivalent-logic arithmetic.
Admin
You need an equality test too.
Admin
Extra points if the program can output a copy of itself in your choice of language.
Admin
How π came into it, I'll never know. But his last part about
cout>>8.14
was just him adding Fizz and Buzz, which he appeared to have determined to equal 5 and 3.14 respectively, and printing them out as requested.Maybe I should have myself committed for managing to possibly understand the method behind that madness.
Admin
Hey, counting to 100 should be enough for anybody.
Admin
I prefer to go the other direction. FizzBuzz in BrainF*ck.
Admin
Surly you can build an equality test from an 'is zero' operator.
Admin
Wow, I was going to post my Scheme version, but that BrainF**k version beats that all hollow. Oh, well, I'll post it anyway:
EDIT: removed a little bit of redundancy. HTH. DOUBLE EDIT: I forgot the requirement to print the numbers which don't match the pattern. Fixed.
Admin
I should dig out the one my buddy did which was in MSSQL.
Admin
Here's my fizzbuzz contribution:
Admin
wait... since when could you use the number 1 as a variable in python?
i want to call shenanigans, but i'm half afraid that Guido would have implemented that.
Admin
Looks like Jeff was right about something!
http://blog.codinghorror.com/fizzbuzz-the-programmers-stairway-to-heaven/
Admin
I like that he was right about this because it angers @blakeyrat.
Admin
Don't need modulo, just a couple of countdowns... here's an implementation in NetLogo.
Admin
You can't. Not really. That's why I like that solution so much, because you get to say things like "if 1 != 100" and it will eventually be false. :-)
A hint: """ delimits multi-line strings in Python.