import java.util.Scanner;

public class Kayles { // https://en.wikipedia.org/wiki/Kayles
	
	public static Scanner in = new Scanner(System.in);
	public static boolean[] hasPin; // array indicating whether there is still a pin standing at the given position
	public static int player; // current player 1/2
	
	/**
	 * initialize - Initialize the game.
	 */
	private static void initialize() {
		// Print intro text
		System.out.println("The Game of Kayles (Random Initialization)");
		System.out.println("Each turn, knock down one or two adjacent pins.");
		// Prompt user for game specification
		System.out.print("How many pins (1-99)? ");
		int numPins = in.nextInt();
		System.out.print("Probability of pin standing? ");
		double probStanding = in.nextDouble();
		// Initialize game state
		hasPin = new boolean[numPins];
		for (int i = 0; i < numPins; i++)
			hasPin[i] = Math.random() < probStanding;
		player = 1;
	}
	
	/**
	 * isGameOver - Return whether or not the game is over.
	 * @return whether or not there is still a legal move, that is, at least one pin standing
	 */
	// TODO - implement

	/**
	 * takePlayerTurn - Attempt to take a turn.  If the user input is an illegal move, return false.
	 * @return whether or not a legal play was made
	 */
	// TODO - implement

	/**
	 * printKayles - Print the state of the Kayles game.
	 */
	private static void printKayles() {
		// Print pins
		for (boolean pin : hasPin)
			System.out.print(pin ? '|' : ' ');
		System.out.println();
		// Print indices (up to 99)
		if (hasPin.length > 10) { // print 10s place of indices
			for (int i = 0; i < hasPin.length; i++)
				System.out.print(i >= 10 ? ("" + i / 10) : " ");
			System.out.println();
		}
		for (int i = 0; i < hasPin.length; i++) // print 1s place of indices
			System.out.print(i % 10);
		System.out.println();
	}

	/**
	 * main - Play a game of Kayles.
	 * @param args (unused)
	 */
	public static void main(String[] args) {
	    // TODO - implement
	}
}
