/* PigletSolitairePlayer - a simple interface to a player that plays Piglet Solitaire.
 * 
 * Piglet Solitaire is a simple jeopardy coin game.  The goal is to reach a given goal score in a given number of turns.
 * Initially, a player's score is 0, the turn total is zero, and the turn number is 0.  (The last possible turn number is the number of turns - 1.)
 * A player's choice is always simply whether to "flip" a coin or to "hold" and end the turn.
 * If the player chooses to "flip" there are two equiprobable outcomes:
 *   HEAD - the turn total increases by 1, and the turn continues, or
 *   TAIL - the turn total resets to 0, and the turn ends with the score unchanged. Note that the turn number increments at the end of a turn.
 * If the player chooses to "hold", the score is increased by the turn total, the turn total resets to 0, and turn ends.
 * The player wins if, within a given number of turns, the player's score reaches a given goal score.
 * An optimal player chooses to "flip" or "hold" so as to maximize the probability of winning.
 * 
 * @author Todd W. Neller
 */

public interface PigletSolitairePlayer {
	
	/**
	 * @param goalScore - score that must be reached in the alloted number of turns
	 * @param numTurns - number of turns in which a player must reach the goal score
	 */
	void initialize(int goalScore, int numTurns);
	
	/**
	 * @param score - current player score, initially 0 at the start of the game.
	 * @param turnTotal - current turn total, initially 0 at the start of each turn.
	 * @param turn - current turn, initially 0 at the start of the game.  The last turn is (numTurns - 1).
	 * @return whether the player will choose to flip a coin (true) or hold (false) 
	 */
	boolean willFlip(int score, int turnTotal, int turn);
}
