Everyone's worst code! - Printable Version +- Forums - Open Redstone Engineers (https://forum.openredstone.org) +-- Forum: Off-Topic (https://forum.openredstone.org/forum-4.html) +--- Forum: Programming (https://forum.openredstone.org/forum-8.html) +--- Thread: Everyone's worst code! (/thread-685.html) |
Everyone's worst code! - Xeomorpher - 08-01-2013 Here is a new thread, where we must post the bits of code everyone is embarrassed about! I'll start Code: ###RSW's code for finding the colour of a ranking This is an excert from my TofuJumper game, which was made mainly to annoy mort. Code: global loc, vel, clox, plat, l, r, jumpwait, highest, m, plats, cv, cloc, mplats, mplat, powerups, ability, abilityc, jumppower, sinit, gent, score, gravity, size, Xrange, Poslist, squish, squishv, cubes RE: Everyone's worst code! - bannanalord - 08-01-2013 Code: def message(message): This is the worst I could think of. RE: Everyone's worst code! - mort96 - 08-01-2013 TequilaJumper! Made for Ludum Dare with minimal amounts of experience, it's not of my prettiest of works. It did however spawn some offspring in the form of xeo's TofuJumper. Because of open sourceness, the source code can be found here: https://github.com/mortie/tequilaJumper So, let's have a look at it shall we? You don't even have to look at any of the source code to find the first horrible decision. Everything in one file. One index.html, containing almost 800 lines of source code. Yeeah. Opening the file, we see even more disastrous code. Take for instance this draw code:[line 218] Code: gameCtx.fillStyle = "rgba(0, 0, 0, 0.5"; This one-liner is quite extraordinary too:[line 271] Code: gameCtx.fillRect (Math.floor(platformX[i]), Math.floor(drawYModifier(platformY[i], platformHeight[i])), Math.floor(platformWidth[i]), Math.floor(platformHeight[i])); In the code for handling the movement of platforms (which is a complex mess of work too by the way, starting at line 283 and ending at 349): [line 324] Code: //HAAAAAACK! Yup. Encountered a bug I didn't manage to fix, so I simply hacked my way around it using an extremely dirty trick. Another thing, which isn't as clearly expressed in the code, but maybe is worst of them all: When a platform is disappearing off of the screen, it doesn't disappear. It's still stored in memory - it doesn't get overwritten by new platforms. This leads to a very ugly memory leak. That's right. Platforms never despawn. That's a selection of the worst parts of the code. Other ineresting areas are:
Oh, and I almost forgot: Almost all variables are global. Just look at the variable declaration part [line 7-73] :S EDIT: to my defence, it _was_ made for Ludum Dare, AND I attended a party which took most of my weekend. The time was therefore very limited. It's also very fun to hack away on code, not spending a single thought on structure, and just see where you end up. The code becomes extremely horrible and unreadable, but it's still very fun ;P RE: Everyone's worst code! - David - 08-02-2013 My exapmles will fill up the HDD of this server so I won't post them RE: Everyone's worst code! - mad1231999 - 08-02-2013 The worst code I have in my current project: Code: void kprintf(char *format, ...) RE: Everyone's worst code! - mort96 - 08-02-2013 blagpostified the post I wrote here: http://mortie.org/blog?post=my_worst_code :3 RE: Everyone's worst code! - Chibill - 08-03-2013 My worest code was the first batea of AdditionalCrafting I will not post for it would burn Xeo's eyes out. RE: Everyone's worst code! - Billman555555 - 08-03-2013 My turn: Code: !break! int portserial = 20 ; Not needed also. STUPID PORT SYSTEM FOR JAVA. PS. this is one of 250gb of bad code I have D: Just remembered that the //arduino bit isn't needed. RE: Everyone's worst code! - Xeomorpher - 08-03-2013 '250gb of bad code' If a gb contained 1,000,000,000 bits, and plain text was 2 bytes per character, that would be 125,000,000 characters. if a line of code was on average 50 lines long (We're assuming this is bad code), then that would be 25,000,000 lines of code... do you have magic fingers? oh, and you have 250 of those gb... that makes a total of 6,250,000,000 lines of code. RE: Everyone's worst code! - VirtualPineapple - 08-04-2013 I thought text was 1 byte per character... RE: Everyone's worst code! - Billman555555 - 08-04-2013 ^ yea it is Anywho: 250gb is over exaggerated, more like 100gbs and half of that is deleted. So 50gbs is about it. RE: Everyone's worst code! - mort96 - 08-04-2013 ASCII text is 1 byte per char. In Unicode, the amount of bits per char isn't specified AFAIK, but it's often set to 16 bits per char. The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!) RE: Everyone's worst code! - Billman555555 - 08-04-2013 Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaannnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnddddddddddddddddddddddddddddddddddddd........................ He is gone. Dingding. RE: Everyone's worst code! - Iceglade - 08-05-2013 Code: #Bounce off paddles with VERY sucky collision detection Whut. RE: Everyone's worst code! - JeremyG - 08-05-2013 Code: a=[1,2,3,4,5] I honestly have no clue. This outputs [2,3,4,5] RE: Everyone's worst code! - Billman555555 - 08-05-2013 (08-05-2013, 09:16 PM)JeremyG Wrote: hmmmmmm....... Code: a=[1,2,3,4,5] ?? that did 1,2,3,4,5?????????? I failed Meh ive all ways been crappy at Java>>V Code: println.(a[i-2]) RE: Everyone's worst code! - Thor23 - 08-07-2013 (08-05-2013, 09:16 PM)JeremyG Wrote: It's because the a array is zero indexed. The i value itself starts at zero, but because of this bit here: a=[1,2,3,4,5] print([a[i+1] for i in range(len(a)-1)]) it starts the array's index at 1 instead of zero. Lucky that the range comes out to 4, otherwise you might end up trying to access a nonexistent element. RE: Everyone's worst code! - Chibill - 08-07-2013 I will post my java code from my mod that was derpy. RE: Everyone's worst code! - VirtualPineapple - 08-09-2013 Then why not post it q_q RE: Everyone's worst code! - Chibill - 08-09-2013 I will I have to decompile my old old version and hope its not obsfated. RE: Everyone's worst code! - Billman555555 - 08-09-2013 InvisibleGrammaNazi Wrote:(08-09-2013, 08:34 PM)Chibill Wrote: I will I have to decompile my old old version and hope its not obsfated.<<Obsufacated. RE: Everyone's worst code! - Thor23 - 08-10-2013 SpellingNazi Wrote:InvisibleGrammaNazi Wrote:**Obfuscated(08-09-2013, 08:34 PM)Chibill Wrote: I will I have to decompile my old old version and hope its not obsfated.<<Obsufacated. Grammar Nazi's should NEVER try to correct spelling. OT: I would post something of mine here, but I'm not really sure what of mine would be considered bad. I mean sure, I've got old programs that could have been written better, but I wrote them with what I knew at the time. RE: Everyone's worst code! - Chibill - 08-10-2013 Code: try { RE: Everyone's worst code! - Chibill - 08-19-2013 No one cares about my worst code. :-C RE: Everyone's worst code! - JeremyG - 08-19-2013 (08-07-2013, 12:43 AM)Thor23 Wrote:(08-05-2013, 09:16 PM)JeremyG Wrote: I mean I know why it does that, I just don't know why I have that code RE: Everyone's worst code! - Chibill - 08-20-2013 Why has xeo not come a rages about my worest java code I have? RE: Everyone's worst code! - Neogreenyew - 09-05-2013 Step aside noobs. Let me tell you about Apocalyptic Minefield. Let the pro at bad coding step forward and teach you all a few things. https://docs.google.com/file/d/0B1Iapcb8FjwcR0hWLXFGZUJOeTg/edit?usp=sharing It's a GDocs zipped file with a single .exe in it. This is my first ever coding project that I made back in high school. Not only does it not work for shit, but every single action loads a different form. At the time, I had no idea how to code or use arrays, so it's pretty brutal. I'd also like to point out that the minefield part is incredibly horrible. There are red squares with one blue one mixed in. Click on a red and you lose, click on blue and you win. Oh and one last thing... GET ON MY LEVEL, NOOBS RE: Everyone's worst code! - EDevil - 09-05-2013 Hoeraay For self expression @Neo. And, i don't program (Yet), So im one of the few peeps who doesn't have bad code. Ha! RE: Everyone's worst code! - Iceglade - 09-15-2013 This topic cannot die! ... i tried to code an mcedit filter Code: #Generate redstone wiring RE: Everyone's worst code! - Xeomorpher - 09-15-2013 list(str(list(X))) Yeaaaa RE: Everyone's worst code! - tokumei - 09-19-2013 Best example of bad code: Minecraft Beta 1.8. Its performance was HORRENDOUS. RE: Everyone's worst code! - Xeomorpher - 09-20-2013 How about the whole of MC? RE: Everyone's worst code! - Chibill - 09-20-2013 In 1.6.4 they fixed many bugs that starved threads. |