Using Deep Learning to Analyze X-Wing Dice and Eliminate Cheating




Perfect dice should always roll without any side coming up more often than the others. If you only roll them a few times, you can expect to see some sides more often. But given a sufficient number of rolls, there should be no significant statistical deviation. However, you’re probably familiar with weighted dice, which have been purposefully fabricated to favor a particular side. That’s usually done on purpose to cheat, but it can also happen as a result of imprecise manufacturing. To find out if that was an issue with the dice included in the Star Wars: X-Wing miniatures game, Andrew Lauritzen built a contraption for analyzing the dice rolls.

The Star Wars: X-Wing game comes with two kinds of dice: red and green. Both kinds of dice are eight-sided and indicate what kinds of actions or advantages a player has on their turn. To test them, Lauritzen gathered a total of 30 dice — 17 red and 13 green — from different editions of the game. Those were then placed in an automated tower roller machine constructed out of wood. The tower pivots in the center and is turned by servos controlled by an Arduino. Inside the tower there are four channels that force the dice to tumble. Each time the tower is flipped, the dice land on a transparent plastic platform where a webcam takes a photo of them.

A Python script is used to crop the webcam photo into images of the individual dice. Those are passed to a trained deep learning convolutional neural network (CNN) that determines which side they landed on, with a reported 100% accuracy. That data is then deposited in a CSV (Comma-Separated Value) list so it can be analyzed in a spreadsheet. Using this machine, Lauritzen performed 20,000 rolls of each dice, for a total of 600,000 rolls.

The results of the analysis are disconcerting. Only four of the 30 dice were “fair,” and the rest had a significant bias. Theoretically, players could find those dice and have an advantage. Casino dice don’t have that problem because they’re very precisely machined, but that isn’t practical for a low-cost game like this. Lauritzen did, however, find that 3D-printed dice actually performed much better. At the very least, you should probably consider sharing dice in your next Star Wars: X-Wing game in order to prevent cheating.


Using Deep Learning to Analyze X-Wing Dice and Eliminate Cheating was originally published in Hackster Blog on Medium, where people are continuing the conversation by highlighting and responding to this story.





Original article: Using Deep Learning to Analyze X-Wing Dice and Eliminate Cheating
Author: Cameron Coward