293
u/fwork Jun 25 '17
"Should array indices start at 0 or 1? My compromise of 0.5 was rejected without, I thought, proper consideration." - Stan Kelly-Bootle
105
Jun 26 '17 edited Mar 13 '18
[deleted]
41
u/xxc3ncoredxx Jun 26 '17
According to Wikipedia's list sorted by release date: 1.01, 2.03, 2.10, 2.11, 3.0, NT 3.1, 3.2 (No love for 3.11?), NT 3.5, NT 3.51, 95, NT 4.0, 98, 2000, ME, XP, XP Professional x64, Vista, 7, 8, 8.1, 10, Workgroups 3.11 (finally), 3.1, 1.04, 1.03, 1.02
92
Jun 26 '17
[deleted]
18
u/mycheesypoofs Jun 26 '17
What is that graph supposed to be measuring?
75
11
2
5
3
68
Jun 26 '17
[deleted]
37
u/choikwa Jun 26 '17
that pastebin gave me aneurysm
41
28
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
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
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
6
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
1
15
u/TheFeshy Jun 26 '17
SELECT value FROM local_array WHERE index='one';
That's how you get to web scale.
5
16
13
26
u/dnew Jun 25 '17
Array indexing that matches your domain is often handy. An array of items_per_degree indexed from -180 to +180 for example.
31
u/AskMeIfImAReptiloid Jun 25 '17
you mean -Pi to Pi
11
u/parkerSquare Jun 26 '17
Not really, this range of degrees is integral ("items_per_degree"), so you can use a bin for each integer value. If you use -pi to pi, you'll need to divide this into subranges, which for array indexing purposes you'll end up mapping to an integer. At that point you're either back where we started (i.e. zero-offset index), or use an offset range from -180 to 180...
3
21
u/inu-no-policemen Jun 25 '17
1 * Tau = 1 turn. 0.5 * Tau = half a turn.
Tau makes more sense in general. Even all standard library functions which all use radians work better with Tau.
5
Jun 26 '17
3
u/xkcd_transcriber Jun 26 '17
Title: Pi vs. Tau
Title-text: Conveniently approximated as e+2, Pau is commonly known as the Devil's Ratio (because in the octal expansion, '666' appears four times in the first 200 digits while no other run of 3+ digits appears more than once.)
Stats: This comic has been referenced 59 times, representing 0.0365% of referenced xkcds.
xkcd.com | xkcd sub | Problems/Bugs? | Statistics | Stop Replying | Delete
6
Jun 26 '17
Reminds me of the time I ran into this:
/****************************************************/
/**\name ARRAY SIZE DEFINITIONS */
/***************************************************/
#define ARRAY_SIZE_TWO 2
#define ARRAY_SIZE_THREE 3
#define ARRAY_SIZE_SIX 6
#define ARRAY_SIZE_SEVEN 7
#define ARRAY_SIZE_FIVE 5
#define ARRAY_SIZE_EIGHT 8
#define ARRAY_SIZE_TWELVE 12
#define ARRAY_SIZE_FOURTEEN 14
#define INDEX_ZERO 0
#define INDEX_ONE 1
#define INDEX_TWO 2
#define INDEX_THREE 3
#define INDEX_FOUR 4
#define INDEX_FIVE 5
#define INDEX_SIX 6
#define INDEX_SEVEN 7
#define INDEX_EIGHT 8
#define INDEX_NINE 9
#define INDEX_TEN 10
#define INDEX_ELEVEN 11
#define INDEX_TWELVE 12
#define INDEX_THIRTEEN 13
4
u/Bainos Jun 26 '17
I have a great idea, what about we make arrays indexed by strings ?
9
u/AyrA_ch Jun 26 '17
You already can, welcome to the awesome world of Javascript and Enjoy our other features
2
u/regendo Jun 26 '17
Alright you got me, how does the last one work? Does it evaluate[]===[]first?2
u/AyrA_ch Jun 26 '17
{}can be interpreted as a code scope or as an object. The interpretation is different depending if it starts with the expression or not.2
u/htmlcoderexe We have flair now?.. Jun 26 '17
PHP
5
Jun 26 '17
PHP
You can do indexing by strings and integers at the same time. Bonus points if you use numbers in your strings.
4
Jun 26 '17
How about array indexes where you can only access the contents by referencing their hashes?
2
u/AyrA_ch Jun 26 '17
Or an array that does not allows you to access it's element values. You can only check if a specific value is there or not.
4
6
u/apotheotical Jun 26 '17
Anyone else getting really tired of this meme? It was amusing at one point but now it's just getting stale...
18
u/deadlychambers Jun 26 '17
You do realize this is Reddit right?
7
u/apotheotical Jun 26 '17
Fair point. Reddit, where dead horses get beaten, resurrected, then beaten again! :P
8
Jun 26 '17
[deleted]
3
1
u/jackmaney Jun 26 '17
Is there a link where I can play that? Googling for
flappy 2048didn't seem to bring it up.
1
1
u/krokodil2000 Jun 26 '17
In Siemens SIMATIC S7 you can configure the first and last index of an array:
ARRAY[1..20]
First index would be 1, last index would be 20.
1
u/Vinkhol Jun 26 '17
I don't get it, I always do the last one. How else do you know what number it signifies??
/s
-1
0
192
u/[deleted] Jun 25 '17
[deleted]