public class YahtzeeUtil
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String[] |
catNames
Strings containing single-character category names
|
static boolean[][][] |
idToRerollIdToFlags
array where first index of roll id and second index of reroll id maps to boolean array with true values corresponding to indices of corresponding roll array that are to be rerolled
|
static int[][][] |
idToRerollIdToIndices
array where first index of roll id and second index of reroll id maps to int array listing indices of corresponding roll array that are to be rerolled
|
static int[][] |
idToRoll
integer array mapping roll id to int array with ascending sorted roll values
|
static int |
NUM_CATEGORIES
number of categories
|
static int |
NUM_DICE
number of dice
|
static int |
NUM_RANKS
number of ranks
|
static int |
NUM_ROLLS
number of unique sorted rolls of NUM_DICE dice with NUM_RANKS ranks
|
static double[][][] |
rollRerollRollTransitionProbs
array where first index of roll id and second index of reroll id and third index of next roll id maps to a probability of transitioning to next roll given roll and reroll action.
|
static int |
UPPER_BONUS_LIMIT
upper section bonus limit
|
Constructor and Description |
---|
YahtzeeUtil() |
Modifier and Type | Method and Description |
---|---|
static int |
getNumRerolls(int[] roll)
Return the total number of unique reroll actions for the given roll
|
static void |
getRerollFlags(int rerollId,
int[] roll,
boolean[] reroll)
Given rerollID and roll, write reroll booleans to given reroll array.
|
static double |
getRollProb(int rollId,
int numDice)
Given a roll id and the given number of dice, return the probability of getting that roll when rolling that number of dice.
|
static void |
main(java.lang.String[] args)
Test method for YahtzeeUtil.java
|
public static final java.lang.String[] catNames
public static final int NUM_CATEGORIES
public static final int NUM_DICE
public static final int NUM_RANKS
public static final int UPPER_BONUS_LIMIT
public static final int NUM_ROLLS
public static final int[][] idToRoll
public static final boolean[][][] idToRerollIdToFlags
public static final int[][][] idToRerollIdToIndices
public static final double[][][] rollRerollRollTransitionProbs
public static int getNumRerolls(int[] roll)
roll
- ascending sorted roll valuespublic static void getRerollFlags(int rerollId, int[] roll, boolean[] reroll)
rerollId
- id number of reroll optionroll
- ascending sorted dice rollreroll
- mutable "output" array to contain boolean value corresponding to whether or not same index in roll array is to be rerolled according to reroll ID.public static double getRollProb(int rollId, int numDice)
rollId
- roll id numbernumDice
- the number of dice being rolledpublic static void main(java.lang.String[] args)
args
- (unused)