Ever since my son and I worked on whether different types of 20-sided dice were fair I’ve been thinking about whether there might be some oddly shaped dice that could still be fair. I’ve watched these three numberphile videos and I’ve looked at these dice. All of which seems to suggest that if you have identically shaped sides, you’re in business. But I’ve still been wondering about other weird shapes.

So I’ve decided to see if I can search for some. This post lays down things I’ve discovered as I’ve geared up to a huge optimization run [SPOILER: I haven’t run it yet]. Here’s the list:

- There is an angle you can drop a stick (without rotating) so that it’ll hit twice and bounce right back up without rotating.
- Figuring out the correct response to a rigid body bounce on a hard surface was more complicated than I’d thought it would be.
- Using Mathematica’s ConvexHullMesh was a cool way to make random multi-sided dice.
- Getting Mathematica to use “WhenEvent” to determine impacts and then implement point 2 above was frustratingly difficult.
- Doing bounces like I have in the past (treating the ground as a stiff half-spring) works well and lets me do some energy loss mechanisms that I couldn’t figure out in point 4 above.
- Soft versus hard surfaces affect the roll (defined as the side that ends up down).
- My kids have helped me a ton:
- They think adding in translations in addition to rotations and bounces is important. I’m not sold, but it makes for cool animations.
- They think hard surfaces look better.
- They think most of the energy loss happens at the bounces (my first approach was to use a lot of air resistance and have the bounces be pure – especially when doing point 4 above).

- Determining which side is “down” was trickier than I thought – though I’m open to other suggestions.
- Ultimately I’d like to get feedback on the assumptions I’m building in so that when I run the optimization I can trust the results.

Given that it’s late on a Sunday night, I think I’ll just show some of my results (graphics and animations below) and see what sorts of questions folks have:

Rebound velocity of stick: This shows the rebound velocity of the center of mass of a stick that has symmetric masses on it. (think —0—-0— or 0———–0 or -0———-0- etc) where the position of the masses as measured from the center is the x-axis. Note that where the velocity crosses zero is the point where the stick would only rotate after the first bounce and therefore the motion would be totally symmetric (it would ultimately bounce right back up with the opposite angle with respect to the horizontal but without any rotational energy).

This shows a dumb mistake I was making: I was assuming that the center of mass of a polygon was equal to the center of mass of the vertices. As you can see below, that’s true for triangles but not for other polygons (COM_reg means center of mass of the region whereas COM_pts is the center of mass of the vertices).

Success bouncing a 2D shape. After finally giving up on the WhenEvent approach in Mathematica, I just said that any vertex that goes below the ground needs to experience an upward constand force. The horizontal line is the original height of the center of mass.

Showing that you really do get different rolls with a triangle. Note that now I’ve added in some friction.

Histogram of 100 rolls for that triangle. You can tell than 100 rolls isn’t good enough since surely eventually side 2 should land more often.

A 4-sided shape and accompanying histogram after 1000 rolls (note that each roll takes 0.5 seconds).

Combing through the data I found one of the rare ones where it lands on side 1:

Ok, I got 3D bouncing working!

And I can do lots of sides!

Here’s a 16-sider with some nice color added.

Here’s a 6-sider comparison showing a soft (top) and hard (bottom) floor. Note the difference in the ultimate side that ends up down.

Here’s a plot of the side that’s down as a function of time for the animation above. The blue curve is the soft surface and the red curve is the hard surface.

Ok, so I know I haven’t put much detail in yet, but I wanted to at least get down some of what I’ve been working on. The next step is to check some of my assumptions with you fine readers and then to go ahead and do some long optimization runs. I was thinking of doing a genetic algorithm, but then I’d need a ton of runs (keeping in mind, of course, that each roll takes a while (0.5 seconds in 2D, 2 seconds in 3D).

So some questions for you:

- 2D is way faster, is it worth my time to explore it?
- I do friction in the following way (does it bother you?):
- if it’s not in contact with the floor, there’s no energy loss
- If it’s in contact with the floor, there’s a contribution to the force that’s proportional to the velocity for those variables related to the vertex that’s in the floor.
- Note that means I’m not doing sliding friction but rather viscous friction.

- By adding in translation, I have 2 more variables to keep track of (I’m already doing z(t) of the center of mass and the 3 Euler rotation angles). Worth it?
- Doing a 1-d minimization would be much faster than something like a genetic algorithm. What would that variable be for, say, a 6 sided die?
- What do you mean by a fair die? How much variation after, say, 1000 rolls is small enough for you? I’ve asked my kids what it would take for them to be suspicious of any dice they own (big D&D players) and they’ve got some interesting opinions.

So, can you help? Here are some starters for you:

- I’m in this class and . . . wait . . . nevermind
- Seriously, you haven’t posted since February and this is all you can come up with??!!
- I think this is cool. I think you should . . .
- I think this is dumb, I think you should . . .
- Once again that promise to switch to python wasn’t worth the breath it took to say it, I see.
- Here’s my address where you can send your new 3D printed dice to me.
- Even 1000 roles isn’t enough. This will never be done to my satisfaction.
- What about dice where a few sides almost never come up but the rest have near equal probability?
- Without even looking at your code I know what your WhenEvent problem is. Here’s how to fix it . . .
- I would have thought it would be obvious that a rigid body should bounce off an infinitely massive floor such that the local velocity of the part that hits the ground reverses its z-component and that there’s only one solution for the speed of the center of mass and the rate of change of the Euler angles that both conserves kinetic energy and correctly accounts for the expected change in angular momentum!
- I don’t understand why you say it’s hard to figure out which side is down. Just look at it!

I think this is cool. . .and that’s all I got. But it is super-cool, and I love that you do this type of stuff.

This is awesome. It’s like the PhD dissertation that I wanted to write – but didn’t. Also, have you done an analysis of real actual rolling dice? You could see if translation makes a real difference or not with real dice.

I feel dumb for not having thought of that. I know there’s a lot of auto dice rollers out there. I wonder how many do a significant amount of translation.

Regarding the simulation of a 2D triangle you write:

” You can tell than 100 rolls isn’t good enough since surely eventually side 2 should land more often.”

I’m not so sure about that. When the dice “almost” lands on side 1 it seems really likely that it might tip over to 3. 3 might actually be the most likely side to land on.

that’s a really great point! I’m mad that I didn’t save that particular triangle shape to go re-run, but I’m sure I can get close to it.