r/ProgrammerHumor • • Aug 01 '22

>>>print(“Hello, World!”)

Post image
60.8k Upvotes

5.7k comments sorted by

View all comments

Show parent comments

1.3k

u/bob1689321 Aug 01 '22

Because 1-6 would make too much sense

78

u/partytoni1 Aug 01 '22

I guess 0-5 would have had more sense, but...

129

u/lesbianmathgirl Aug 01 '22

1-6 would make more sense, because if I'm calling a function named after a 6-sided die (yes there are other types of die, but the 6-sided one is the Platonic form), it should return the same results as you'd expect of a 6-sided die.

78

u/know_greater_evil Aug 01 '22

Exactly, this is the same reason I have all my factory classes print manufacturing sounds to the console.

Ex: BRRRRRR, WOA-THUUMP, SSSSSC SSSSSC

5

u/sascha-sphw Aug 02 '22

You made my day!

Now I am having a tough time concentrating on work again...

0

u/[deleted] Aug 01 '22

[deleted]

48

u/lesbianmathgirl Aug 01 '22

The 6-sided die is, for the majority of people, the closest physical manifestation of the abstract idea of a die. Or put another way, when most people hear the word "dice"*, they imagine a 6-sided one. For comparison, Plato would say the Platonic form of a triangle is the equilateral triangle.

*For consistency I was going to stick with "die", but it would be a lie to say that when most people hear "die" they think of anything other than death.

11

u/partytoni1 Aug 01 '22

She means that there are several types of dices, like the ones you use in a D&D game for example, that does not have 6 faces. But the de facto standard when you think about a die is the 6-sides one.

→ More replies (1)

6

u/bobsburgerbuns Aug 01 '22

A cube is a Platonic solid, though there are others, and they can certainly be used for dice as well.

5

u/tjdavids Aug 01 '22

I think that every platonic solid is a pretty common die shape. Like maybe not ones you'd see everyday, but like if you played like 50 board games you'd probably have seen each of them once.

3

u/trenthany Aug 02 '22

Anything beyond 6 is fairly rare in the US outside of RPG/tabletop gamer culture. The common board games in the US almost all use 6 sided die. I’m sure there are exceptions but not many until you get into a specific subculture.

3

u/[deleted] Aug 02 '22

DnD is a pretty common game tbf

3

u/trenthany Aug 02 '22

But in the US walk into any common store, not a gaming store with gamenights and the like, but places like meijer, Kmart, Walmart, target and go to board games. There will be almost guaranteed only cubical 6 sided die in every game there. Now I’m not saying there aren’t a lot of gamers, but remember when I’m programmerhumor we’re a bunch of geeks and will likely understand rolling a natural 20 etc. outside of certain groups though this is practically unknown.

2

u/BangkokPadang Aug 02 '22

I have a game called “football fever” that has 4 sided die, but they’re oblong and shaped like a football.

They’re definitely the “strangers” die I’ve ever seen/used, even though they make perfect sense in context of a football game.

→ More replies (4)

4

u/XiaoXiongMao23 Aug 02 '22

Actually, in addition to the d6 cube die, the d4 tetrahedron, d8 octahedron, d12 dodecahedron, and d20 icosahedron could all be considered Platonic as well ;)

→ More replies (2)

0

u/partytoni1 Aug 01 '22

You are correct, but i was thinking in a programming way, where indexes always start at 0. If you have to show the number to the user, than 1-6 is better

5

u/lesbianmathgirl Aug 01 '22

Sure, indexes start at 0, but that doesn't mean we always want a 0 result. There are several times where in programming, even when the result isn't shown to the end user, you want to return a random result 1-n instead of 1-(n-1). For example, if I want to determine how much damage an entity does (where the base result can't be 0), it would be awkward to do random(0,5)+1 every time, when what I really want is 1-6. Or even worse, let's say that I want to return 5 times a random multiplier from 1-6. Would you really want to handle this as 5*(Die.Die()+1)? I would expect a function called Die() to meet the cases when what I care about is (1,6).

→ More replies (1)

0

u/[deleted] Aug 02 '22

[deleted]

8

u/fecal-butter Aug 02 '22

Its not, but i believe 1-7 means 7 isnt included, or at least i hope it cant return 7 different values.

→ More replies (1)
→ More replies (1)

13

u/[deleted] Aug 02 '22

When I began programming in Python, this is what fucked me up. Ranges include the first number, but not the second number? I would constantly forget which one is included and which one is not.

5

u/SandyDigsPhreedom Aug 01 '22

And this does. Yes...of...of course - nervous liberal arts sweating-

4

u/LeafyGreensOnToast Aug 02 '22

because import die in python is like importing a bunch of info from a library called "die". die as in dice, see below lol:

5

u/SandyDigsPhreedom Aug 02 '22

Oh “die” die! Yes that makes more sense than “die” die.

(For real though thank you)

3

u/hoopbag33 Aug 02 '22

Knowing you fucks it's probably 0-5 that makes the most sense to you

→ More replies (1)