|
|
|
| Hurry! Enter The Daily WTF's OMGWTF2 Contest by June 28th! - Prizes! Fame! Trophies! Do your worst: http://omg2.thedailywtf.com/ |
| « Prev | Page 1 | Page 2 | Page 3 | Page 4 | Page 5 | Next » |
|
If statements are the answer to all problems. If it's not working, you aren't using enough.
|
|
Oh my god it is full of code
|
|
The person who produced this code is a true genius!
|
|
That is a work of art.
|
|
At least it's properly indented.
|
|
So, is some brave soul going to run that and see what it does?
|
|
Easy, just look at the unit tests, they should tell you what the code does.
|
Evidently not a system to check for duplicated modifiers! |
|
I didn't want to see this. Life is meaningless now. I want to die.
|
|
My guess? This is an incredibly clever quine.
|
|
Please don't tell me this is looking for duplicates!!!
|
|
OMG!!! And I thought the code here was bad...
|
|
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?
|
|
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.
|
|
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...
|
Funniest comment this week. |
|
I bet a dime this was done by a COBOL programmer learning VB.
|
|
If you scroll up and down really fast you can see a sailboat!
|
|
Wait... *jump into* a for loop? But... ha- ... whu- ... how is this even possible?
|
|
I hope the developer followed the arrow created by that code.
Exit Stage Right. |
|
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.
|
|
The guy who wrote this is a genius. This is a prime example why you should never let a genius anywhere near your code.
|
|
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? |
Re: The "Who Knows?" Code
2009-12-02 09:25
•
by
Martin
(unregistered)
|
|
"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. |
|
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.
|
Re: The "Who Knows?" Code
2009-12-02 09:29
•
by
-
(unregistered)
|
See above for truth.
Yeah, I hate smart peop... Wait, no, it's you I hate. |
Re: The "Who Knows?" Code
2009-12-02 09:32
•
by
highphilosopher
(unregistered)
|
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. |
Re: The "Who Knows?" Code
2009-12-02 09:34
•
by
Prosthetic Lips
(unregistered)
|
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). |
|
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... |
|
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. |
Re: The "Who Knows?" Code
2009-12-02 09:40
•
by
csdx
(unregistered)
|
Actually with everything at 15, the code would basically do nothing. At each for loop, there's an if statement checking if the current iteration is equal to any other iteration, and exiting the loop if it does. So with only 15 possible values (1-15) there isn't any way the code will ever get to the innermost statement since there are 16 variables which need to be unique to get there. 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. |
Re: The "Who Knows?" Code
2009-12-02 09:40
•
by
Crash Magnet
(unregistered)
|
|
[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. |
|
Ahh... this code brings back good memories.
See? It looks just like the Homeworld Hiigaran mothership. Good times were had with her. |
|
I was trying to follow along, but after I got past i10, I began to feel a little i11.
|
Re: The "Who Knows?" Code
2009-12-02 09:48
•
by
artie
(unregistered)
|
|
it's not a sailboat, it's a schooner. Stupid!
|
Re: The "Who Knows?" Code
2009-12-02 09:48
•
by
jim
(unregistered)
|
|
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? |
|
The goggles, they don't work!!
|
|
1. I guarantee that there is at least one bug in this code.
2. +1 for using "uplift". :-) captcha: saepius. Opposite of sapient. See code above. |
|
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. |
|
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.
|
Re: The "Who Knows?" Code
2009-12-02 09:54
•
by
OMG
(unregistered)
|
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. |
Re: The "Who Knows?" Code
2009-12-02 09:55
•
by
BSDGuy
(unregistered)
|
|
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? |
Re: The "Who Knows?" Code
2009-12-02 09:56
•
by
Anonymous Organ Donor
(unregistered)
|
The goggles, they don't work??? Sorry... But... it's "The goggles, they do nothing!" - it's painful, like having my 6 year old use bad grammar, I have to correct her |
Re: The "Who Knows?" Code
2009-12-02 09:56
•
by
SR
(unregistered)
|
|
:oD Now you owe me a fresh coffee and a new monitor.
|
Re: The "Who Knows?" Code
2009-12-02 09:56
•
by
SR
(unregistered)
|
|
I meant:
:oD Now you owe me a fresh coffee and a new monitor. |
Re: The "Who Knows?" Code
2009-12-02 09:59
•
by
blindio
(unregistered)
|
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? |
|
Real WTFs:
1. 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. 2. The source control system that can tell you who has made changes to the code, but not which changes they made. |
Re: The "Who Knows?" Code
2009-12-02 10:16
•
by
BD
(unregistered)
|
Oh, aren't you just precious. |
Re: The "Who Knows?" Code
2009-12-02 10:17
•
by
Mz Name?
(unregistered)
|
Maybe a psychotherapist can help you to stop suffering from that pain. |
| « Prev | Page 1 | Page 2 | Page 3 | Page 4 | Page 5 | Next » |