Automated Die Testing

Are the contents of a Crown Royal bag fair? No, they never are. What about dice? In a quest for good randomness, [Apo] designed and built an automated die tester. Not only does it shake the die up, it captures images so real, actual statistics can be done on each individual die.

The setup is a n acrylic box made with BoxMaker attached to a 3D printed adapter for a stepper motor shaft. Randomizing the die happens exactly like you think it would: a stepper shakes the box, and a camera underneath takes a picture. With a bit of computer vision, this image can be translated into a number, ready for the statistics package of your choice.

There were only 559 rolls before the 3D printed mess of duck tape fell apart, but a test of the distribution revealed this die to have a 92% probability that it is fair. That’s not good.

Creating a cheating die is much more interesting, and to find out if he could do it, [Apo] stuck a die in an oven at 100° C for a few minutes. Surprisingly, the fairness of the die got better, suggesting it’s possible to correct an un-fair die. Putting it back in the oven after that threw the fairness out of the window but there was still no visual difference between this modified die and the original stock die.

22 thoughts on “Automated Die Testing

  1. Free idea for a product. USB dice. Mount a camera over a platform covered with the same regulation felt used on gaming tables in Las Vegas. Develop a dice API for games, local and online. Include “throw verification” that watches the motion prior to the dice stopping to keep people from cheating by placing the dies with the desired numbers up.

    Or just park a camera over a dice popper from a Trouble game.

    1. A while back I saw a setup like that, only it was a machine for flipping pennies.

      I’ve also seen hardware RNGs that use radiological decay, but that’s boring. :V

  2. Measuring the stats in testing is very interesting. Even if the dice are machined “perfectly”, heating one side could create residual surface tension in the plastic that causes a non-uniform bounce and increases the probability of a particular result.
    It could be as simple as heating one face – on a hot surface or with air – and then quenching that face in cool liquid. Or heating the entire die and allowing one side to cool more slowly.
    The surface the dice are tossed on might also be significant.
    I see expensive dice for sale that are supposedly casino spec.
    559 tosses is a fairly small sample. I have never been inside a casino but would be interested in more test results.

    1. I’d do more samples, but at the moment I can only use my DSLR (webcams are too low-quality for proper detection, or I’m not enough of a CV wizard). And DSLR shutters are only rated for so many pictures, so stuff like this is hell for them :)
      A friend’s working on writing a small android app to let me use my phone for this instead, then I’ll make some much bigger experiments.

        1. My lighting’s actually pretty decent. It’s just that the webcam I have is /really/ terrible. It’s a 3$ thing from China. Plus mounting the thing at an acceptable distance is a bit fiddly. Putting my Nikon on the floor and mounting the box on the desk is just about right with a 105mm lens. A phone should be okay since you can just lay it on a chair or something and it’ll face in the right direction. Most webcams are made to take pictures horizontally, not vertically. :)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.