// TODO Put your file header here

/**
 * Program plays the game Farkle.
 * 
 * <p>See https://en.wikipedia.org/?title=Farkle for more details.
 * 
 * @author YOUR NAME HERE
 */
public class Farkle {

	// YOU MAY NOT DECLARE STATIC FIELDS in Farkle
	// All values must be passed to and from methods (as described by method 
	// headers)
	
	/**
	 * <p>Users set the number of players (2-6) and score needed to win
	 * for a game of Farkle.
	 * 
	 * <p>Players take turns rolling dice and try to accumulate the required
	 * number of points. The game ends when the first player to accumulate
	 * enough points is declared the winner. 
	 * 
	 * <p>Program execution starts here.
	 * 
	 * @param args UNUSED
	 */
	public static void main(String[] args) {
		// TODO
		
		/*
		 * This is where you should put your welcome message and main 
		 * program loop. Make sure to match your output to what's described
		 * in the project specification.
		 */
	}
	
	/**
	 * Print a help menu to the console.
	 * 
	 * See the provided sample output for this menu.
	 */
	private static void printHelp() {
		// TODO
	}
	
	/**
	 * Rolls the dice for the current turn. Newly rolled dice should be stored
	 * in a new integer array, and a record of these dice should be stored
	 * in allDice. currentRollNum indicates the number of the current roll
	 * (0-indexed), which should be used to index into allDice when storing.
	 * 
	 * <p>Each die MUST BE ROLLED using the Dice.rollDie() method. 
	 * To debug your code with a predictable sequence of dice rolls, 
	 * invoke Dice.rollDie(true). To generate a random sequence of dice rolls
	 * for better testing, invoke Dice.rollDie(false). See the Dice class 
	 * Javadoc for more information.
	 * 
	 * @param dice The 1D-array of dice to be rolled
	 * @param allDice The 2D-array of dice, representing all rolls for this 
	 * turn. The current roll will be stored into this array.
	 * @param currentRollNum The number of the current roll, used to store
	 * rolled dice into allDice
	 * @return The new 1D-array of rolled dice
	 */
	private static int[] rollDice(int[] dice, int[][] allDice, int currentRollNum) {
		// TODO
	}
	
	
	/**
	 * Print a 1D-array to the console.
	 * 
	 * <p>Output should be formatted as follows:<br />
	 * [dice1, dice2, dice3, dice4, dice5, dice6, ]<br />
	 * e.g., [2, 4, 4, 3, 1, 6, ]
	 * 
	 * <p>Do not print dice that are no longer available, e.g., dice whose
	 * value is 0.
	 * 
	 * @param dice The 1D-array of dice to be printed to the console
	 */
	private static void printDice(int[] dice) {
		// TODO
	}
	
	/**
	 * Print a 2D-array to the console.
	 * 
	 * <p>Output should be formatted as follows:<br />
	 * [turn1dice1, turn1dice2, turn1dice3, turn1dice4, turn1dice5, turn1dice6, ]<br />
	 * [turn2dice1, turn2dice2, turn2dice3, turn2dice4, turn2dice5, turn2dice6 ]<br />
	 * etc.<br />
	 * e.g.,<br />
	 * [2, 4, 4, 3, 1, 6, ]<br />
	 * [1, 3, 2, 5 ]<br />
	 * where each 1D array enclosed in [] is a row in the 2D-array.
	 * 
	 * <p>Do not print dice that are no longer available, e.g., dice whose 
	 * value is 0.
	 * 
	 * <p>Do not print uninitialized dice, e.g., dice whose value is -1.
	 * 
	 * @param allDice The 2D-array of dice (representing all rolls for this 
	 * turn) to be printed to the console
	 */
	private static void printDice(int[][] allDice) {
		// TODO
	}
	
	/**
	 * Print a record of all dice rolled so far during this turn
	 * and the number of points earned so far.
	 * 
	 * <p>Output should be formatted as follows (where X is the currentTurnScore):<br />
	 * [turn1dice1, turn1dice2, turn1dice3, turn1dice4, turn1dice5, turn1dice6, ]<br />
	 * [turn2dice1, turn2dice2, turn2dice3, turn2dice4, turn2dice5, turn2dice6 ]<br />
	 * etc.<br />
	 * X points so far this turn.<br />
	 * 
	 * @param allDice The 2D-array of dice (representing all rolls for this 
	 * turn)
	 * @param currentTurnScore The current score for this turn
	 */
	private static void printTurn(int[][] allDice, int currentTurnScore) {
		// TODO
	}
	
	/**
	 * Compute the score for the currently rolled dice. 
	 * 
	 * Dice should be scored using the following algorithm:
	 * <ol>
	 * <li>Find all groupings of dice of the same number (die showing 0 do not count)
	 * <li>The largest group (> size 1) of dice of the same number will be worth 
	 * points; the number of points is equal to the number of dice in the group. 
	 * <li>If more than one die number has the same size group, the smallest die 
	 * number should be used.
	 * <li>If no groups > size 1 exist, 1 point can be earned if there is a die 
	 * with the number 1. 
	 * <li>Otherwise, 0 points are earned.
	 * </ol>
	 * 
	 * <p>Dice that are found to be worth points should be set to 0, indicating
	 * that they are no longer available to be re-rolled later in this turn.
	 * 
	 * <p>For example:<br />
	 * [2, 3, 4, 3, 5, 6]<br />
	 * 	is worth 2 points (for the two 3s)<br />
	 *  resulting dice = [2, 0, 4, 0, 5, 6]<br /><br />
	 * [2, 3, 4, 3, 2, 6]<br />
	 * 	is worth 2 points (for the two 2s)<br />
	 * 	resulting dice = [0, 3, 4, 3, 0, 6]<br /><br />
	 * [0, 3, 4, 2, 0, 6]<br />
	 * 	is worth 0 points (because there are no groups and no die showed 1)
	 * 
	 * @param dice The 1D-array of current dice.
	 * @return The score earned by dice.
	 */
	private static int scoreDice(int[] dice) {
		// TODO
	}
	
	/**
	 * Resets all dice to an "unrolled" value of 1.
	 * 
	 * @param dice The 1D-array of dice to be reset
	 */
	private static void resetDice(int[] dice) {
		// TODO
	}	
	
	/**
	 * Resets all dice rolls to an uninitialized value of -1.
	 * 
	 * @param allDice The 2D-array of dice to be reset
	 */
	private static void resetDice(int[][] allDice) {
		// TODO
	}
	
	/**
	 * Checks how many dice are still available to be rolled. A die is no longer
	 * active if it has a value of 0.
	 * 
	 * @param dice The 1D-array of dice to check
	 * @return The number of dice that are still available to roll
	 */
	private static int numRemainingDice(int[] dice) {
		// TODO
	}
	
	
	/**
	 * Print all current scores to the console.
	 * 
	 * <p>Output should be formatted as follows:<br />
	 * Player 1: X<br />
	 * Player 2: X<br />
	 * etc.<br />
	 * where player 1's score is stored at index 0 in the array.
	 * 
	 * @param scores The 1D-array representing player's current scores.
	 */
	private static void printScores(int[] scores) {
		// TODO
	}

	/**
	 * Determines if one of the players has accumulated
	 * enough points (>= neededPoints) to win. 
	 * 
	 * @param scores The 1D-array of current scores
	 * @return The index of the winning player if one exists, else -1
	 */
	private static int findWinner(int[] scores, int neededPoints) {
		// TODO
	}
}
