public class PigSolitaireSolver
extends java.lang.Object
Constructor and Description |
---|
PigSolitaireSolver(int goal,
int turns)
Solve Pig Solitaire for a given goal score and maximum number of turns using dynamic programming.
|
Modifier and Type | Method and Description |
---|---|
double |
pWin(int i,
int j,
int k)
Return the probability of winning with optimal play given the current score, number of turns completed,
and current turn total.
|
boolean |
shouldRoll(int i,
int j,
int k)
Return whether or not an optimal player should roll given the current score, number of turns completed,
and current turn total.
|
public PigSolitaireSolver(int goal, int turns)
goal
- goal score to reach within the given number of turnsturns
- maximum number of turns to reach the goal scorepublic double pWin(int i, int j, int k)
i
- player scorej
- number of completed turnsk
- current turn totalpublic boolean shouldRoll(int i, int j, int k)
i
- player scorej
- number of completed turnsk
- current turn total