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”
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.
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
I am almost certain I have heard of this actually being implemented, possibly as a way to circumvent some archaic law requiring real dice rolling (instead of allowing computerized RNG) in an online gambling game.
Here on HaD there was project a couple of years ago where you tweeted at a machine and it rolled a real die for you and gave the result.
There it is.
This machione stuck with me…
Quack quack… I’m a duck tape!
Duck tape was the original name. They’re not supposed to use duck tape on ducts though I’ve worked on many a house that has had it.
You must die
I prefer my languages with duck taping, not duck typing
These folks managed to do the dice-rolling thing BIG!
This is usually what happens when you combine actual data and dice.
A rotary encoder to create a closed loop control scheme would correct the mild skew over time.
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.
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.
Buy a better webcam. Gear Head webcam 8MP sensor and will take 8MP shots. good enough for this kind of stuff.
Sure, I could do that. Or I could use the stuff that I have lying around or can print ;)
Try working on your lighting? Webcams have tiny lenses and sensors, so they’re really sensitive to the quality of the lighting.
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. :)
How did you know I keep my dice in a Crown Royal bag? Spy!!!!
The NSA has known that for years…. B^)
Was the comment about the whisk[e]y itself? Not “fair” as only the wealthy can afford it?
Please be kind and respectful to help make the comments section excellent. (Comment Policy)