• LCrawford (unregistered)

    Simple, instead of trying to grok the if(), frist just set a boolean output array in a database, with a module to allow the users to click and toggle seat availability by concert date.

  • bvs23bkv33 (unregistered)
           IF ((((WP09-DEAL-AMOUNT = ZEROES)
           OR (WP09-DEAL-AMOUNT = SPACES))
           AND ((WP03-AMT-VALUE1 = ZEROES)
           OR (WP03-AMT-VALUE1 = SPACES))
           AND ((WP03-AMT-VALUE2 = ZEROES)
           OR (WP03-AMT-VALUE2 = SPACES))
           AND ((WP03-AMT-VALUE3 = ZEROES)
           OR (WP03-AMT-VALUE3 = SPACES))
           AND ((WP03-AMT-VALUE4 = ZEROES)
           OR (WP03-AMT-VALUE4 = SPACES))
           AND ((WP03-AMT-VALUE5 = ZEROES)
           OR (WP03-AMT-VALUE5 = SPACES))
           AND ((WP03-TAX-TRANS-AMT = ZEROES)
           OR (WP03-TAX-TRANS-AMT = SPACES))
           AND ((WP03-TAX-COMM1 = ZEROES)
           OR (WP03-TAX-COMM1 = SPACES))
           AND ((WP03-TAX-COMM2 = ZEROES)
           OR (WP03-TAX-COMM2 = SPACES))
           AND ((WP03-TAX-COMM3 = ZEROES)
           OR (WP03-TAX-COMM3 = SPACES))
           AND ((WP03-TAX-COMM4 = ZEROES)
           OR (WP03-TAX-COMM4 = SPACES))
           AND ((WP03-TAX-COMM5 = ZEROES)
           OR (WP03-TAX-COMM5 = SPACES))
           AND ((WP03-TAX-COMM6 = ZEROES)
           OR (WP03-TAX-COMM6 = SPACES))
           AND ((WP03-COMM-AMT1 = ZEROES)
           OR (WP03-COMM-AMT1 = SPACES))
           AND ((WP03-COMM-AMT2 = ZEROES)
           OR (WP03-COMM-AMT2 = SPACES))
           AND ((WP03-COMM-AMT3 = ZEROES)
           OR (WP03-COMM-AMT3 = SPACES))
           AND ((WP03-COMM-AMT4 = ZEROES)
           OR (WP03-COMM-AMT4 = SPACES))
           AND ((WP03-COMM-AMT5 = ZEROES)
           OR (WP03-COMM-AMT5 = SPACES))
           AND ((WP03-COMM-AMT6 = ZEROES)
           OR (WP03-COMM-AMT6 = SPACES)))
           OR (WP03-UNCLEARED-PERIOD NOT = SPACES))
            NEXT SENTENCE
           ELSE
            ADD WM-TOTAL-DEBIT-AMT TO WM-AVAIL-BAL-AMT
            ADD WM-TOTAL-DEBIT-AMT TO WM-BOOKBAL-AMT
           END-IF.
    
  • not actively trolling (unregistered)

    TRWTF is "theater"

  • Zach (unregistered)

    This looks like beautiful ASCII art

  • JO (unregistered)

    Yeah, clearly that should be nested ternaries!

  • Murray (unregistered)

    Another WTF: Not separating logic from presentation (mixing seat availability with drawing colors). Editing WTF:

    Also, what's "fat"?

  • Dude (unregistered)

    fat[r][c] = new Seat();

    Looks like a multi-array of seats.

  • Little Bobby Tables (unregistered) in reply to Murray

    Someone who needs two seats. Du-uh.

  • Kasran (unregistered)

    Oh no, it's another Hanzo story - wait... [straightens glasses] oh, Hamza. My bad.

  • (nodebb)

    Please someone analyse this and report the chances of two people being granted the same seat due to race conditions. (And I don't mean racing from the aisle to the seat they're ticketed for)

  • (nodebb) in reply to cellocgw

    if a race condition occurs and two people are assigned the same seat, then that condition calls for a race and the first one there gets to sit. This is the very definition of a "race condition". I don't see the problem.

  • (nodebb)

    They have to wait for the music to stop first, though.

  • Little Bobby Tables (unregistered) in reply to Barry Margolin 0

    "Lovely concert, ruined by the two a**eholes running round and round the auditorium who wouldn't sit down until the last note of the last movement had died away, at which point they both tried to sit in the same b100dy seat."

  • leus (unregistered)

    I don't see the problem in refactoring this. How hard is to create a "seats" array with true or false values based on this logic? Just slap the condition in a Linqpad session and dump the results.

    Oh heck, here you go.

    https://friendpaste.com/4UjeGCaxlc9XRSss3xktOt

  • (nodebb)

    r > 24

    You know, in case the number of seats changes.

  • Drone (unregistered) in reply to KattMan

    No, the race condition is even better than that: both people race for the seat, and the first person to reach it sits down. The second person to reach the seat sits directly on top of the first person, and suddenly the first person disappears and it's like they were never there at all.

  • Hamza (unregistered) in reply to Murray

    FAT stands for the Fine Arts Theatre.

  • COBOL_DINO (unregistered) in reply to bvs23bkv33

    Ah good old COBOL. <3 This is actually something I saw a lot in productive code....a true WTF.

  • (nodebb)

    Since we are hard coding anyway, one could have gone all the way and arranged the code so that it looked like the layout of the theater itself! THAT would be a "beauty with a purpose".

    (Make a few of these, make them inherit from an abstract Layout class, and you have a usable system! Not bad for a one-theater-business with a fixed set of alternative layouts.)

    I am not sure whether I am being sarcastic.

  • Hamza (unregistered) in reply to cellocgw

    A race condition wasn't possible because the program only ran on one system and you had to manually add the number of people attending, and it would then sort everyone and where they would sit by outputting a file with the names and seat numbers. It took about 30-45 minutes to run generally. It was pure gold. Not.

  • (nodebb) in reply to JO

    ` fat[r][c] = ((c <= 0 || c == 17 || c == 18 || c == 54) ? null : ((r <= 24 ? ((r == 14 ? null : ((r == 23 ? (((c == 19 || c == 36 || c == 20) ? null : (((c == 5 || c == 50 || c == 6 || c == 49 || c == 7 || c == 51) ? new Seat() : (((21 <= c && c < 36) ? null : new Seat())))))) : (((c == 1 || c == 2 || c == 37 || c == 38) ? null : ((r == 22 ? ((c == 19 ? null : (((c == 36 || c == 20 || c == 5 || c == 50 || c == 6 || c == 49 || c == 7 || c == 51) ? new Seat() : ((c == 39 ? null : new Seat())))))) : (((c == 3 || c == 53) ? null : ((r == 24 ? (((3 < c && c < 17 || c == 19 || c == 20 || 21 <= c && c <= 36 || 38 < c && c < 53) ? null : new Seat())) : ((c == 19 ? ((r > 0 ? null : new Seat())) : ((c == 36 ? (((1 <= r && r <= 15) ? null : new Seat())) : ((c == 20 ? (((r == 15 || r > 22) ? null : new Seat())) : ((r <= 19 ? (((c == 4 || c == 52) ? null : ((r <= 11 ? (((c == 5 || c == 50) ? null : ((r <= 9 ? (((c == 6 || c == 49) ? null : ((r <= 7 ? (((c == 7 || c == 48) ? null : ((r < 6 ? (((c == 8 || c == 47) ? null : ((r < 4 ? (((c == 9 || c == 46 || (r == 1 ? (c == 10 || c == 45 || c == 51) : c == 51)) ? null : new Seat())) : ((c == 51 ? null : new Seat())))))) : ((c == 51 ? null : new Seat())))))) : ((c == 7 ? new Seat() : ((c == 51 ? null : new Seat())))))))) : (((c == 6 || c == 49 || c == 7) ? new Seat() : ((c == 51 ? null : new Seat())))))))) : ((c == 5 ? ((r <= 14 ? new Seat() : ((r <= 17 ? null : new Seat())))) : (((c == 50 || c == 6 || c == 49 || c == 7) ? ((r <= 14 ? new Seat() : ((r <= 15 ? null : new Seat())))) : ((c == 51 ? ((r < 18 ? null : new Seat())) : ((r <= 14 ? new Seat() : ((c == 39 ? null : new Seat())))))))))))))) : (((((c == 5 || c == 50 || c == 6 || c == 49 || c == 7 || c == 51) ? r > 22 : c == 39)) ? null : new Seat())))))))))))))))))))))) : null)));

    if(fat[r][c] == null) { rec.setFill(Color.WHITE); } `

    Addendum 2018-10-19 19:52: Oh, and it was all nicely formatted too for easy reading...

  • Calli Arcale (unregistered) in reply to leus

    I assume the reason it's hard to refactor is not because this function is hard to refactor, but because an application with this sort of WTFery is going to have a lot more of it elsewhere. I don't even want to know how the application handled coupons or variable pricing.....

  • (nodebb)

    Reminds me of the PERL obfuscation contests.

Leave a comment on “The Theater of the Mind”

Log In or post as a guest

Replying to comment #500499:

« Return to Article