Download presentation
Presentation is loading. Please wait.
1
Matthew Renner, Trish Beeksma, Patch Kenny
Yahtzee Algorithms Matthew Renner, Trish Beeksma, Patch Kenny
2
Abstract This presentation discusses three algorithms that were designed and analyzed to produce the highest average score from a game of Yahtzee. The algorithms tested are Lower Section Strategy, Upper Section Algorithm, and a Naïve Algorithm. The average score, and point distribution were collected and compared after running 1,000,000 Yahtzee games.
3
Yahtzee Description The goal of Yahtzee is to obtain the highest total score. Yahtzee is played with five dice and has thirteen scoring categories. Each of the scoring categories have different point values. The player has 13 turns in each game and may roll a subset of dice up to three times before choosing a scoring category from one of the remaining unused categories for each turn. By the end of the game each scoring category will be assigned one score. The final score is the sum of all the categories.
4
Yahtzee Categories 1’s 8. 4 of a kind
2’s Full house (3 of one number, 2 of another) 3’s Small straight (four sequential dice) 4’s Large straight (five sequential dice) 5’s Yahtzee (5 of a kind) 6’s Chance (any combination) 3 of a kind
5
Informal Problem Statement
Find an algorithm that will determine which dice to keep on each roll and what category to fill that returns the highest average score in a game of Yahtzee for a sufficiently large number of games.
6
Formal Problem Statement
The final score of a game of Yahtzee, F, is given by the sum of the upper section score, upper, and the sum of the lower section score, lower. F = upper + lower Where upper = and lower = And where N is the set of scores, si , from each of the 13 categories in Yahtzee such that N = Note: in accordance with the rules of Yahtzee, if upper is greater than or equal to 63, upper = upper + 35.
7
Formal Problem Statement
Constraints: Each category is assigned one score and only one score by the end of the game. Scoring Constraints: Scoring Categories: If then If then If then If then
8
Algorithms: Lower Section Strategy Upper Section Strategy Naive
9
Lower Section Strategy
This Lower Section Strategy will always attempt choose the most optimal outcome for the current roll . The most optimal outcome for a roll can be calculated by evaluating each category in the lower section using the formula: Pi = vi * (⅙)n Where P is the current category, i is the number of the category, v is the point value of the category, and n is the number of dice required to be rolled to meet the requirements of that category.. Then choose the category with the maximum value from the set: {P1, P2, P3 … P13}
10
Upper Section Strategy
This strategy focuses on obtaining the 35 bonus points by making it a priority to get on average three of a kind in each upper section category to get at least 63 points. Steps: For each roll the highest recurring dice from the categories left in the upper section will be kept until the upper section has been filled. The score will be kept if it is at least three of a kind or if the addition of the score makes the upper section equal 63. If the score is not used for the upper section the category that yields the highest score will be marked in the lower section. Once the upper section if filled, the algorithm will implement the Lower Section Strategy.
11
Naive Algorithm Goes for yahtzee every turn (highest point total)
Rerolls all dice but highest recurring one (in case of tie choose lowest number) Chooses the score that yields the highest points O(n) time and space complexity
12
Naive Algorithm reroll pseudoCode
Funct rerollLogic(roll): dieCount <- [0]*6; for dice in roll: dieCount[dice-1]++; //shows how many 1s,2s etc were rolled modeDie <- max(dieCount)+1; reroll <- [ ]; i = 0; while i<len(roll): if roll[i] == modeDie: reroll.add[i] return reroll
13
Naive Algorithm with Straights Consideration
Naive Algorithm only got an average of points from straights(out of max of 70) (small straight 24.1%; large straight 0.2%) Adds a condition where if the roll is a small straight, it changes priority to trying to obtain a large straight (as long as both straights haven’t been marked already)
14
Analysis First ran 1,000,000 games for each strategy with independently randomly generated rolls Then focused on just rerolling strategy outside the context of the running scorecard
15
Lower Section Data Complexity O(n2) Time Taken: 27 minutes 20 seconds
Average Score: 154.3 Standard Deviation: 37.1 Max Score: 332 The distribution of the graph is skewed left which is NOT optimal.
16
Upper Section Data Complexity: O(n2) and Ω(n)
Time Taken: 14 minutes 30 seconds Average Score: 192.8 Standard Deviation: 42.3 Max Score: 343 The bonus 35 points were obtained 94.66% of the games. The Lower Section Strategy was used for an average 4.5 turns per game
17
Upper section histogram
Had a consistent floor of around 110 Local maxima occur when the average nonzero marks ≅ an integer Average nonzero marks
18
Mostly Naive Data Time and space complexity: O(n)
Time Taken: 11 minutes 4 seconds Average Score: 184.4 Standard Deviation: 37.8 Max Score: 339 Yahtzee percentage: 42.3% Straights combined average: 50.6 Small Straight 82.5% ; large Straight 64.6%
19
Naive Steps Put rolls of lengths 5-100 in algorithm
Incremented a step counter for each iteration of the 2 loops in the algorithm
21
Controlled rolling Controlled for dice rolls by generating the same stack of 15 “dice rolls” to be used for each algorithm The die chosen to be rerolled get their new value by popping the stack (this step happens twice) The final dice are then evaluated for each scoring method in N (the set of scoring methods) Compared to the best solution which is exhaustively found (which was O(22n))
22
Controlled rolling Percent Same as Exhaustive: Lower: 17% Upper: 10%
Naive: 19%
24
Future Work For the Lower Section Strategy, modify it so it takes more consideration in the upper section while still prioritizing the lower. If the right balance could be achieved, this algorithm could outperform other strategies used in Yahtzee. The same could be accomplished by modifying the Upper Section Strategy.
25
Questions What type of problem is scoring as high as you can in a game of Yahtzee? An Optimization Problem. Why is there no guaranteed solution for the Yahtzee optimization problem? Because the randomness of dice rolling makes it impossible to get one single solution 100% of the time. Why is playing 10,000 games of Yahtzee better for testing algorithms than 100 games? Due to the randomness, it is harder to gauge how well the algorithms performed at lower sample sizes. Having larger sample sizes help remove the element of “just being lucky.” How could the Upper Section and Lower Section Strategies be modified to obtain a higher score? By giving more priority to the other section and not solely prioritizing one section. What was the time complexity for exhaustive search and why was this the case? O(22n) because the dice can be rerolled twice and there are 2n ways to choose a reroll.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.