Had a friend complain that his clicker game ran like shit and asked for help. That's exactly what it looked like, and that's exactly what it was, but several separate stacks of metric shit tons of if/else and god knows how many booleans. The number of lines was unreal for an idle game.
Spent some time over two days to totally refactor it into mostly simple loops which cut it down to well under 10% of the original number of lines, got rid of all the unnecessary booleans since their purpose could just be handled within the math, commented everything explaining what I'd done and how it works in relation to how he'd done it, the whole nine.
He texts me fifteen minutes after I send it: "I can't read it anymore."
I remember when I didn't know how to use for loops so I just used while loops all the time. But we all know that while loops are still the best. #WhileLoopsForever
100 layers of if statements should generally just result in a "failed this exercise". It's bad practise and shouldn't ever be allowed at a University that has some self-respect.
Donec tincidunt erat sed pretium interdum lectus erat fringilla lacus fermentum scelerisque leo eros non tortor Ut posuere sapien augue et cursus diam tristique nec Quisque luctus semper ante a viverra Cras non risus ac enim volutpat bibendum sed et odio Morbi dolor risus dictum quis turpis eget ultrices auctor nunc Fusce laoreet elit vel urna accumsan lobortis Praesent lacus purus hendrerit non faucibus at tristique a turpis Nulla euismod orci consectetur luctus efficitur mauris magna imperdiet justo at bibendum lorem est quis mauris
,,,,,,,,,,,........ - here's the punctuation for this text, put them where you want them
An average sentence, in a German newspaper, is a sublime and impressive curiosity; it occupies a quarter of a column; it contains all the ten parts of speech--not in regular order, but mixed; it is built mainly of compound words constructed by the writer on the spot, and not to be found in any dictionary--six or seven words compacted into one, without joint or seam--that is, without hyphens; it treats of fourteen or fifteen different subjects, each enclosed in a parenthesis of its own, with here and there extra parentheses, making pens with pens: finally, all the parentheses and reparentheses are massed together between a couple of king-parentheses, one of which is placed in the first line of the majestic sentence and the other in the middle of the last line of it--AFTER WHICH COMES THE VERB, and you find out for the first time what the man has been talking about;
445
u/dario_p1 Jan 10 '22
The real question is what did you do to get that many nested scopes
189
u/Cloakknight Jan 11 '22
Image Transcription: Code
I'm a human volunteer content transcriber and you could be too! If you'd like more information on what we do and why we do it, click here!
212
u/tiddayes Jan 10 '22
This guy eats a KitKat in one big bite across the bars
2
u/fecal_brunch Jan 11 '22
I like that they've kept a short line length for readability.
2
u/robin_888 Jan 11 '22
So, there are 219 level of indentation on 653 lines!?
Well...
73
u/trollsmurf Jan 11 '22
Garbage collect the whole application.
30
u/MattCW1701 Jan 11 '22
I'm pretty sure that computer now needs therapy.
18
u/Different-Thing-9133 Jan 11 '22
have you heard of LISP?
12
u/GeneralBookkeeper252 Jan 11 '22
Right to jail, do not pass go
10
u/[deleted] Jan 10 '22
My eyes hurt
10
u/R3D3-1 Jan 11 '22
Forget test-driven programming.
Compiler-error driven programming is the future!
6
u/FrezoreR Jan 11 '22
It's like the tip of an ice berg. It indicates something ominous and scary being close by
6
u/killchain Jan 11 '22
Reminds me of a certain somebody who was like
5
u/fletku_mato Jan 11 '22
The amount of them troubles me more than the layout.
5
u/killchain Jan 11 '22
At some point someone mechanically hits
Alt+Shift+F(or whatever) and all your hard work is gone.3
u/RyanNerd shameless Jan 11 '22
Lisp has entered the chat.
3
u/[deleted] Jan 11 '22
In LISP is fine
3
u/[deleted] Jan 11 '22
If you removed a few blank lines you could end this file on line 666, fits the block of braces really well.
3
u/4hpp1273 Jan 11 '22
I wonder if they write if…else if…else if…else as
2
u/Goldenkrew3000 Jan 11 '22
oh god
2
u/mivoe99 Jan 11 '22
It ain't spaghetti code if it's not indented...
2
u/perseid Jan 11 '22
I'm pretty sure that if you press Tab right now, the computer will explode.
2
u/DeuxAlpha Jan 11 '22
All tests passed. PR approved.
2
u/iEatSoaap Jan 11 '22
I am now immediately homicidal.
2
u/[deleted] Jan 11 '22
If this isn’t because of some minification or compression/encoding I swear I will have an aneurysm
2
u/IrritableGourmet Jan 11 '22
Reminds me of Mark Twain's The Awful German Language:
2
u/notmondayagain Jan 11 '22
How nested do you want your code? Yes.
1
u/framedragger Jan 11 '22
Noooooooooomg
1
u/Sphinx- Jan 11 '22
What the
1
u/AlexLovesBeans Jan 11 '22
yeah just type them until the linter stops having a stroke
1
u/[deleted] Jan 11 '22
As a lisp hacker i don’t see anything wrong here
1
u/doodoo_x Jan 11 '22
those are curly brackets no really, thats the unicode name for them
1
u/gnash117 Jan 11 '22
Part of me really wants to down vote this. This is an epic low in coding. (Here have my upvote) 🤢
1
u/[deleted] Jan 29 '22
Holy Jesus, what the fuck is that?
-1
u/Jakethehusky Jan 11 '22
Why is nobody talking about the fact this guy still has Microsoft edge
0
u/[deleted] Jan 11 '22
[deleted] — view deleted comment