public class PigSolver
extends java.lang.Object
| Constructor and Description |
|---|
PigSolver(int goal,
double epsilon)
Solve Pig for a given goal score using value iteration with a given convergence parameter epsilon.
|
| 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, opponent score,
and current turn total.
|
boolean |
shouldRoll(int i,
int j,
int k)
Return whether or not an optimal player should roll given the current player score, opponent score,
and current turn total.
|
public PigSolver(int goal,
double epsilon)
goal - player goal score to winepsilon - minimum magnitude of pWin change in one value iteration for continuationpublic double pWin(int i,
int j,
int k)
i - current player scorej - opponent scorek - current turn totalpublic boolean shouldRoll(int i,
int j,
int k)
i - current player scorej - opponent scorek - current turn total