• Vince (unregistered)

    wtf

  • Piet (unregistered)

    If statements are the answer to all problems. If it's not working, you aren't using enough.

  • Rodnas (unregistered)

    Oh my god it is full of code

  • Rene (unregistered)

    The person who produced this code is a true genius!

  • frits (unregistered)

    That is a work of art.

  • Alargule (unregistered)

    At least it's properly indented.

  • Osno (unregistered)

    So, is some brave soul going to run that and see what it does?

  • (cs) in reply to Osno

    Easy, just look at the unit tests, they should tell you what the code does.

  • Pragmatopian (unregistered)
    a system used daily by scores of users daily

    Evidently not a system to check for duplicated modifiers!

  • (cs)

    I didn't want to see this. Life is meaningless now. I want to die.

  • Inhibeo (unregistered)

    My guess? This is an incredibly clever quine.

  • (cs)

    Please don't tell me this is looking for duplicates!!!

  • Steenbergh (unregistered)

    OMG!!! And I thought the code here was bad...

  • (cs)

    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?

  • rocco (unregistered)

    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.

  • (cs)

    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...

  • (cs) in reply to Grovesy
    Grovesy:
    Easy, just look at the unit tests, they should tell you what the code does.
    Funniest comment this week.
  • Zapp Brannigan (unregistered)

    I bet a dime this was done by a COBOL programmer learning VB.

  • MC (unregistered)

    If you scroll up and down really fast you can see a sailboat!

  • PSX (unregistered)

    Wait... jump into a for loop? But... ha- ... whu- ... how is this even possible?

  • Name (unregistered)

    I hope the developer followed the arrow created by that code.

    Exit Stage Right.

  • Wladimir (unregistered)

    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.

  • Crash Magnet (unregistered)

    The guy who wrote this is a genius. This is a prime example why you should never let a genius anywhere near your code.

  • (cs)

    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?

  • Martin (unregistered) in reply to Wladimir

    "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.

  • csdx (unregistered)

    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.

  • - (unregistered) in reply to md5sum
    md5sum:
    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...

    See above for truth.

    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.

    Yeah, I hate smart peop... Wait, no, it's you I hate.

  • highphilosopher (unregistered) in reply to PSX
    PSX:
    Wait... *jump into* a for loop? But... ha- ... whu- ... how is this even possible?

    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.

  • Prosthetic Lips (unregistered) in reply to PSX
    PSX:
    Wait... *jump into* a for loop? But... ha- ... whu- ... how is this even possible?

    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).

  • Mike Caron (unregistered)

    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...

  • Patrick (unregistered)

    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.

  • csdx (unregistered) in reply to CaptainOblivious
    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?
    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.

  • Crash Magnet (unregistered) in reply to -

    [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.

  • Daan (unregistered)

    Ahh... this code brings back good memories.

    See? It looks just like the Homeworld Hiigaran mothership. Good times were had with her.

  • Stark (unregistered)

    I was trying to follow along, but after I got past i10, I began to feel a little i11.

  • artie (unregistered) in reply to MC

    it's not a sailboat, it's a schooner. Stupid!

  • jim (unregistered) in reply to Mike Caron

    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?

  • Neville Flynn (unregistered)

    The goggles, they don't work!!

  • noone (unregistered)
    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.

  • Oded (unregistered)

    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.

  • (cs)

    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.

  • OMG (unregistered) in reply to Mike Caron
    Mike Caron:
    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?

    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.

  • BSDGuy (unregistered) in reply to Stark

    You lost me at:

    If m(1) = 0 Then GoTo i2 
      For i1 = 1 To m(1) 
      ....
      Next...
    

    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?

  • Anonymous Organ Donor (unregistered) in reply to Neville Flynn
    Neville Flynn:
    The goggles, they don't work!!
    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
  • SR (unregistered) in reply to Grovesy

    :oD Now you owe me a fresh coffee and a new monitor.

  • SR (unregistered) in reply to Grovesy

    I meant:

    Grovesy:
    Easy, just look at the unit tests, they should tell you what the code does.

    :oD Now you owe me a fresh coffee and a new monitor.

  • blindio (unregistered) in reply to Ren
    Ren:
    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?

    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?

  • (cs)

    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.

  • BD (unregistered) in reply to OMG
    OMG:
    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)
    Oh, aren't you just precious.
  • Mz Name? (unregistered) in reply to Anonymous Organ Donor
    Anonymous Organ Donor:
    Neville Flynn:
    The goggles, they don't work!!
    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

    Maybe a psychotherapist can help you to stop suffering from that pain.

Leave a comment on “The "Who Knows?" Code”

Log In or post as a guest

Replying to comment #292068:

« Return to Article