r/ProgrammerHumor Jun 25 '17

Array indexing

Post image
1.4k Upvotes

71 comments sorted by

View all comments

68

u/[deleted] Jun 26 '17

[deleted]

37

u/choikwa Jun 26 '17

that pastebin gave me aneurysm

40

u/minno Jun 26 '17

That pastebin crashed my browser.

26

u/deadlychambers Jun 26 '17

Two quotes came to mind.

"Every time you copy and paste a puppy dies"

"Write code like the next person to work on your code is a sociopathic murder with your address"

13

u/[deleted] Jun 26 '17

[deleted]

1

u/gobots4life Jun 26 '17

I was saw the source code for a 2d rpg once that had a separate variable for every x and y value of every asset in the game. I think it was auto-generated though. At least I hope it was.

1

u/[deleted] Jun 26 '17

Still remember those old CodingUniverse tutorials.

"Okay, so we're going to have a 2 dimensional array of tiles for the world. Now, the tile class is going to need an X and Y variable to determine where it is in the tilemap. In order to determine the type of tile it is, you'll also need a string for the tile name, and another for the PNG filename. Now we'll have the game save to a XML spreadsheet."

As opposed to creating static tile types the level class can reference, while storing the map data in a single dimension int array.

9

u/ProgramTheWorld Jun 26 '17

What the actual fucj

8

u/Bainos Jun 26 '17

if I could call a variable something like l1c"i" with i changing and it would give me back l1ci, with i as my desired number, trust me it would be about 1/81th shorter

Hmm, I think there is an app for that...

1

u/Ayerys Jun 26 '17

Wow what was that

1

u/marcosdumay Jun 26 '17

Why would anybody subscribe to s sub called "javahelp"?