This code uses a genetic algorthm to play the casino game Sic Bo optimally.
Disclaimer: By construction, no strategy grants the player a positive expected value in terms of payouts. Rather, we solve a slightly different question here.
Sic Bo is played using three fair six-sided dice and a board consisting of predictions for the dice's values. Predictions include but are not limited to the specific sum of the dice (e.g. 4, 9, 12), that a one will be present on one of the faces, that all three of the dice will show the same value, or that a 4 and a 6 will be present in the outcome of the dice. The player bets on which of these outcomes will happen, and they may select as many as they choose and a specific dollar amount for each. Based on the probabilities of these occurrences, a specific payout is granted as a multiple of the initial bet. For instance, a valid bet on all three dice showing the same value pays 31 times the initial bet (1 to 31), and a 4 and a 6 being present pays 1 to 6. Note that specific payouts may depend on the casino; the payouts used here come from an undisclosed casino in Canada.
When individually selected, several events are isometric to each other. Each of these has a negative expected payout, as can be seen through basic statistical computations. A linearity of expectation argument shows that no combination of events leads to positive expected returns, by consequence. Therefore, there is no way to ensure positive returns in the long run when playing sic bo.
Here, we instead ask the following question: which combination of events leads to the greatest probability of making money? If we take a basic example using a $1 bet, the singular event of the sum being "big" (between 11 and 17) pays 1 to 1, and the event has a
- The sum is 3, and we lose both. The payout is -$2.
- The sum is "small," so we make +$1 on the small bet, but lose $1 by consequence of the sum not being "big." The payout is $1 - $1 = $0.
- The sum is "big," which follows the same argument as the sum being "small." The payout is $0.
- The sum is 18, which follows the same argument as the sum being 3. The payout is -$2.
Thus, when selecting these two events, there is a probability of 0 that we see positive returns.
Note that this problem is highly nonlinear, and it depends greatly on which events have already been selected when adding new ones. However, brute forcing the
Running the algorithm several times, we were able to find a combination granting a