Yahtzee ist a popular dice game which combines luck with advantage of the player. The rules are easy and can be read in Wikipedia or other pages. In contrast to some other variants, this programm don't use any bonus rules for a second or third yahtzee. So the maximum reachable score is 375.
See how it works on yahtzee.holderied.de.
Download and unzip one of the following versions:
Don't start the program with double click. Open a command line image (terminal, console, cmd), change into the yahtzee directory and type yahtzee -h, yahtzee.exe -h, ./yahtzee -h or something like this. If you see the help page it works.yahtzee -a - - - - - - - - - - - - - 0
yahtzee -a - - 9 - 15 - 24 - - 30 40 0 - 1 22135This means
yahtzee -a - - 9 - 15 - 24 - - 30 40 0 - 2 22132 yahtzee -a - - 9 - 15 - 24 - - 30 40 0 - 3 22232 yahtzee -a 1 4 9 16 15 18 24 0 25 30 40 0 17 0 yahtzee -a - 2 9 16 15 18 24 0 25 30 40 0 17 0The strategy of the maximum expectation value isn't optimal to beat an opponent. If you play against another player, your goal is only to get more points than your opponent.
yahtzee -a 3 2 9 16 15 18 - 0 25 30 40 0 17 1 25244In this case it's also possible to compute all cases with pencil and paper, but this will take a little time. The strategy computes all cases and is optimal in respect to the goal "reach a given threshold"
p(opponent reaches exactly 0 points) * p(you reach 1 or more points) ... + p(opponent reaches exactly 200 points) * p(you reach 201 or more points) + p(opponent reaches exactly 201 points) * p(you reach 202 or more points) ... + p(opponent reaches exactly 375 points) * p(you reach 376 or more points)You see, the optimal strategy is not precise enough. Would you like to get more points than your opponent or is it enogh to get as much as your opponent. In the second case the goal function is:
p(opponent reaches exactly 0 points) * p(you reach 0 or more points) ... + p(opponent reaches exactly 200 points) * p(you reach 200 or more points) + p(opponent reaches exactly 201 points) * p(you reach 201 or more points) ... + p(opponent reaches exactly 375 points) * p(you reach 375 or more points)The program has implemented both strategies win, winoreven and a third one which is called combined. It's the combination of both and maximizes the expectation of the function win=1, even=0, lose=-1. To analyse a two player situation try:
yahtzee -t p1 - - - - - - - - - - - - - p2 - - - - - - - - - - - - - p1 0 yahtzee -t p1 - - - 12 - - - - - 30 - - - p2 - - - - - - - - - - 40 50 - p1 1 23316
yahtzee -p1 mevSimulate game alone with strategy 2, reach 300 points
yahtzee -p1 t300Simulate games alone with strategy 1
yahtzee -p1 mev 10Simulate games alone with strategy 1, always using the same initial random (to reproduce the experiment)
yahtzee -p1 mev 10 4711Simulate two player game, both playing strategy 1
yahtzee -p2 mev mevSimulate two player game, p1 playing strategy 1, p2 like to win
yahtzee -p2 mev winSimulate two player game, both playing combined strategy
yahtzee -p2 combined combinedSimulate 10 two player games, initial random is 4711
yahtzee -p2 combined combined 10 4711
Felix Holderied (felix@holderied.de) July 10, 2014