import java.util.Random;
import java.io.*;
import java.util.*;
/**
Courtney Fox
Professor Yao
Midterm Part 1
10/10/17
Purpose:
The purpose of this program is to develop a Nim game that consists of a
pile of stones ranging from 10-16. From that pile, both the player and
computer have to pick up to 3 stones and whoever gets the last stone
loses.
Logic:
**/
public class FoxMidQ1
{
public static void main(String[] args)
{
//Variables
int user = 0;
//int computer;
//int loser;
int gamenum = 0;
//Scanner
Scanner input = new Scanner(System.in);
//Welcome Output
System.out.println("Welcome to Nim Game!");
//Get pile size: Randomly generate 10-16
int[] pile = {10, 11, 12, 13, 14, 15 , 16};
int stones = pile[(int)(Math.random() * pile.length)];
System.out.println("Game #"+ (gamenum + 1) +": There are "+ stones + "
stones in the pile.");
System.out.println("You can remove up to 3 stones from pile at a
time.");
//User takes stones
System.out.println("How many stones would you like to remove? ");
user = input.nextInt();
I got the beginning started but I'm stuck at the part where the user is only suppose to take 1,2, or 3 stones from the pile. I tried doing do,while,for,if,else and none of those loops are doing what I want it to do because the user is only suppose to have one turn then its the computers turn to pick up to 3 stones out of the pile.