public class YahtzeeSolver
extends java.lang.Object
Modifier and Type  Field and Description 

static int 
ALL_SCORED
constant encoding the fact that all categories have been scored (game end)

static int[][] 
catRollIdScore
Lookup table of score gained, indexed by score category index and the roll id.

static int 
NUM_CATS
number of scoring categories

static int 
NUM_DICE
number of total dice

static int 
NUM_RANKS
number of dice ranks

static int 
NUM_ROLLS
number of unique sorted rolls for all dice

static int 
UNKNOWN
constant for indicating that a nonnegative integer is unknown

static java.util.TreeMap<java.lang.Integer,java.util.TreeMap<java.lang.Integer,YahtzeeWidget>> 
widgetMap
Multilevel map allowing lookup of YahtzeeWidget objects indexed by scored categories id
and current score (truncated at the upper section bonus limit).

static java.util.ArrayList<java.util.TreeSet<YahtzeeWidget>> 
widgets
List of YahtzeeWidget sets grouped according to 0based turn number.

Modifier and Type  Method and Description 

static double 
getExpScore()
Return the expected score for optimal play of Upper Section Yahtzee.

static java.lang.Object[] 
getOptimalActionAndScore(boolean[] scoredCatsArr,
int[] currentRoll,
int numRerollsTaken,
int score)
Given a boolean array indicating scored categories, an array with the current roll, the number of rerolls that have been taken this turn,
and the current score, return a length 2 Object array where the first Object is an Integer encoding the optimal action, and the second is
a Double indicating the score expected from that action assuming continued optimal play.

static void 
main(java.lang.String[] args) 
static int 
playGame()
Simulate an optimally played game and return the final score.

public static final int NUM_DICE
public static final int NUM_RANKS
public static final int NUM_ROLLS
public static final int NUM_CATS
public static final int UNKNOWN
public static final int ALL_SCORED
public static java.util.ArrayList<java.util.TreeSet<YahtzeeWidget>> widgets
public static java.util.TreeMap<java.lang.Integer,java.util.TreeMap<java.lang.Integer,YahtzeeWidget>> widgetMap
public static int[][] catRollIdScore
public static java.lang.Object[] getOptimalActionAndScore(boolean[] scoredCatsArr, int[] currentRoll, int numRerollsTaken, int score)
scoredCatsArr
 a boolean array indicating scored categoriescurrentRoll
 an array with the current rollnumRerollsTaken
 the number of rerolls that have been taken this turnscore
 the current score a length 2 Object array where the first Object is an Integer encoding the optimal action, and the second is
a Double indicating the score expected from that action assuming continued optimal play.public static double getExpScore()
public static int playGame()
public static void main(java.lang.String[] args)