- 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
wtf
Admin
If statements are the answer to all problems. If it's not working, you aren't using enough.
Admin
Oh my god it is full of code
Admin
The person who produced this code is a true genius!
Admin
That is a work of art.
Admin
At least it's properly indented.
Admin
So, is some brave soul going to run that and see what it does?
Admin
Easy, just look at the unit tests, they should tell you what the code does.
Admin
Evidently not a system to check for duplicated modifiers!
Admin
I didn't want to see this. Life is meaningless now. I want to die.
Admin
My guess? This is an incredibly clever quine.
Admin
Please don't tell me this is looking for duplicates!!!
Admin
OMG!!! And I thought the code here was bad...
Admin
if m(1) = m(2) = m(3) = ... = m(15) = 15, then this code would find all permutations of the numbers 1 through 15, wouldn't it?
Admin
Basic code full of GoTo statements and layers of embedded loops with exits... and no comments. VB doesn't need to be this way. sigh It makes me sad to see justification for the anti-VB rants.
Admin
TRWTF is that apparently Vladmir had the incredible, once-in-a-lifetime opportunity to do a full rewrite of a legacy application, and just sent it to hell by copying and pasting the code that he didn't know what did into the shiny new app...
Admin
Admin
I bet a dime this was done by a COBOL programmer learning VB.
Admin
If you scroll up and down really fast you can see a sailboat!
Admin
Wait... jump into a for loop? But... ha- ... whu- ... how is this even possible?
Admin
I hope the developer followed the arrow created by that code.
Exit Stage Right.
Admin
I'm not the submitter but this seems to generate all possible combinations of i1,i2,i3 where i1,i2,i3 are natural numbers between 1 and m(1),m(2),m(3) respectively. Only that there aren't a just three but 16 variables. Let's hope that most m() values are zero, the number of combinations grows exponentially. Otherwise - yes, some people never get recursion. And - sure, you can "flatten" every recursive algorithm assuming the depth is limited.
Admin
The guy who wrote this is a genius. This is a prime example why you should never let a genius anywhere near your code.
Admin
This looks awesome. But we'd need the m(x) values to make sense, sorry :(
Could the original poster come clean about the approximate return values of the m() function?
Admin
"And - sure, you can "flatten" every recursive algorithm assuming the depth is limited."
You can turn any recursive algorithm into an iterative one without any assumptions. You just need to maintain your own stack.
Admin
I got as far as figuring that it loops over i1 through i16, and before each loop it's checking to see if the number it's using as a max value m(1)-m(16) is 0, if it is, it skips the for statement (and the next statement at the end). Then it does some sort of checking to make sure some things don't equal each other and then creates a combination array that the sum of everything. Why it does any of this is still a mystery.
Admin
See above for truth.
Yeah, I hate smart peop... Wait, no, it's you I hate.
Admin
It's VB man, you can jump in anywhere you want.
So I was sitting there getting ready to read TDWTF when just as I clicked the title of the latest post, Marcy Playground's "Vampires of New York" started on grooveshark <shamelessplug>LOVE GROOVESHARK!!!</shamelessplug>, at the same time I read the first sentence...
"When Vladimir first received his orders, the blood drained from his face."
Between the "Vampires of New York" song, the name VLAD-imir and the reference to draining blood I got the funniest image in my head of a somewhat comical vampire programmer named Vladimir (obviously a cover name). In retrospect, explaining a funny image in your head does not work well in a WTF comment post does it?
Captcha: genitus -- Not touching this one with a ten foot pole.
Admin
He jumps into the for loop, but then jumps OUT using the same condition. Even though m(x) is zero, he still assumes a minimum of 1. I think my first revision would be to find some way around the goto's with maybe a "... to max(m(1), 1)" instead, and see how it cleans up the code.
catcha: amet - using it in a sentence, "It's good to be amet" (baseball team).
Admin
Surely I'm not the only one who is wondering how he managed to paste a bunch of BASIC into a C++ source file and still have it work, am I?
Then again, no one said it still compiled...
Admin
It generates combinations of numbers, in sixteen two-digit blocks, where no two blocks are alike. It then stores them in a collection, presumably to be retrieved at random. This is a key generator for either licensing or encryption.
The code could be a lot cleaner than that, though.
Admin
If m(1) =...= m(15) = 16, then I beleive this should return the sum of the numbers of 1 through 16. It just would have to execute something on the order of 16^16 loops to do so.
Admin
[quote user="Crash Magnet"]The guy who wrote this is a genius. This is a prime example why you should never let a genius anywhere near your code. [/quote]
Yeah, I hate smart peop... Wait, no, it's you I hate.[/quote]
You need genius to solve problems nobody else can. I don't hate 'em. In fact, they are fun people to be around.
As for your feeling for me, get in line.
Admin
Ahh... this code brings back good memories.
See? It looks just like the Homeworld Hiigaran mothership. Good times were had with her.
Admin
I was trying to follow along, but after I got past i10, I began to feel a little i11.
Admin
it's not a sailboat, it's a schooner. Stupid!
Admin
Well, obviously he must have spent an afternoon porting it, line for line, trying not to introduce any bugs.
also: shouldn't he have just checked the VC commit log?
Admin
The goggles, they don't work!!
Admin
I guarantee that there is at least one bug in this code.
+1 for using "uplift". :-)
captcha: saepius. Opposite of sapient. See code above.
Admin
Its not that bad. Its just a (very) weird way of printing all the possible combinations of 1..m(1..16) (resulting in a two dimensional matrix). with the caveat that m(n) might be 0 so you have to take that into consideration.
On the face of it it looks like some sort of scorecard generator for a "lotto" style betting game.
Admin
My god... it's as if Duff's Device fell into a black hole, merged with an alien AI, then came back to Earth centuries later demanding to speak with its creator.
Admin
I was wondering this as well, but my working hypothesis is that the current verison of Migrantsoft(R) Vicious(C) Student(C)(R)(TM) lets you paste in code from any Migrantsoft(C) language, and translates it to Mangled(TM) C+/-(R) at runtime. Happy happy joy joy that I get to stay blissfully unaware of such horrors.
Admin
You lost me at:
At first I was like...oh, just use a case statement, but the motive of the code is...somewhere.
TRWTF is that buddy-boy copied and pasted code that he doesn't understand...that makes less sense than this code.
Then again, this code reminds me of Jolitz's TCP stack code! Fast, but WTF does it do?
Admin
Admin
:oD Now you owe me a fresh coffee and a new monitor.
Admin
I meant:
:oD Now you owe me a fresh coffee and a new monitor.
Admin
I think, actually, that m is an array. so it's just someone stepping through an array and as soon as a non-zero value repeats it exits the loop, if all values are 0 than it formats the values of the i values as two digit numbers. it's really quite.... magnificent, like car accidents on CHiPs.
They appear to be using the for loops to assign the value at each position in the m array to the i values. Looks like someone didn't understand arrays maybe?
Admin
Real WTFs:
Giving the same developers that wrote bad VB5 code the task of rewriting it in C++, and expecting the result to be anything other than equally-bad C++ code.
The source control system that can tell you who has made changes to the code, but not which changes they made.
Admin
Admin
Maybe a psychotherapist can help you to stop suffering from that pain.