Do you love playing dice games? Do you get competitive and find the best strategy to win? If so, this mash-up of dice games and Artificial Intelligence is bound to intrigue you. Click here to play the game.
Stony Brook University PhD Candidates Tian Zhu and Lu Chen, Merry Ma of the Stony Brook School, and Professor Zhenzua Liu of the Stony Brook Department of Applied Mathematics and Statistics, studied the dice game “Pig" with AI to discover the best strategy to win under different circumstances.
This work demonstrates the capabilities of reinforcement learning, a kind of machine learning that trains AI to make decisions for itself and achieve the most desirable outcome. Particularly, it showcases reinforcement learning in action one roll at a time– or rather, multiple at a time.
“Reinforcement learning is an important topic in machine learning and AI. The goal of reinforcement learning is to either maximize reward or minimize penalties. In our case, it’s reward,” says Zhu. “Instead of maximizing the immediate reward, the goal of this reinforcement learning is to maximize cumulative long-term reward.”
Pig is typically a two-player game performed sequentially. This is the general how-to-play:
-
When it’s a player’s turn, they roll the dice to get a numbered score. After they roll once, they can choose to keep rolling, or they can choose to hold, meaning the other player goes.
-
If the player chooses to keep going, they may continue rolling as long as they wish unless they roll the number 1.
-
If the player rolls the number 1, they lose the points they gained that round, and it’s automatically the other player’s turn.
-
The first player to gain 100 points wins.
Even though the original format of Pig is fun for some, a couple of flaws were acknowledged through research. First, it was found that the first player for one-die and two-dice sequential games has an advantage in winning probability. Secondly, if there is a large number of players, the sequential nature of the game can decrease each player’s participation rate because they are forced to wait their turn for long periods of time.
To combat these issues, the research team proposed a simultaneous format rather than sequential– meaning all players would simultaneously roll. When all players either hold or roll the dreaded number 1, the round is over. As a result, the game is more fun and fair for all players.
Using reinforcement learning, the simultaneous Pig game was tested under different circumstances, for instance, 2-player mode and 3-player mode. As a result, various optimal winning strategies were determined for each circumstance.
Pig was made into an online interactive game in which you can compete with the computer to demonstrate the research in action.
“I designed the website and implemented the algorithm designed by Tian. We implement modes including simultaneous and sequential. We also have different difficulties: easy, medium, and hard,” says Chen.
“The computer’s actions are based on the algorithms we derived. Hard is the optimal strategy. For easy or medium mode, the computer will use less competitive strategies,” says Zhu.
-Sara Giarnieri, Communications Assistant