- 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
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.
Admin
Admin
TRWTF is "theater"
Admin
This looks like beautiful ASCII art
Admin
Yeah, clearly that should be nested ternaries!
Admin
Another WTF: Not separating logic from presentation (mixing seat availability with drawing colors). Editing WTF:
Also, what's "fat"?
Admin
fat[r][c] = new Seat();
Looks like a multi-array of seats.
Admin
Someone who needs two seats. Du-uh.
Admin
Oh no, it's another Hanzo story - wait... [straightens glasses] oh, Hamza. My bad.
Admin
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)
Admin
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.
Admin
They have to wait for the music to stop first, though.
Admin
"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."
Admin
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
Admin
r > 24
You know, in case the number of seats changes.
Admin
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.
Admin
FAT stands for the Fine Arts Theatre.
Admin
Ah good old COBOL. <3 This is actually something I saw a lot in productive code....a true WTF.
Admin
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.
Admin
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.
Admin
` 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...
Admin
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.....
Admin
Reminds me of the PERL obfuscation contests.