private static Random random = new Random();
public static void Main(String[] args)
firstTurn = random.Next(2) + 1;
Console.WriteLine("Please enter the amount of chips you would like to play with. Default value is 21.");
Console.WriteLine("You start the game with: " + chipCount);
Console.WriteLine("Please enter the amount of chips you'd like to be able to draw up to each round. Default value is 3.");
while (chipCount != 0 && chipCount >= 0)
Console.WriteLine("The computer will have the first turn this game.");
Console.WriteLine("Chips left on the table: " + chipCount);
comTake = random.Next(chipAmount2) + 1;
Console.WriteLine("My turn. I'm taking " + comTake + " chip(s).");
chipCount = chipCount - comTake;
Console.WriteLine("You will have the first turn this game.");
Console.WriteLine("Chips left on table: " + chipCount);
Console.WriteLine("How many chips do you want to take?");
while (playerTake > chipAmount2 || playerTake < 1)
Console.WriteLine("You can only take between 1 and " + chipAmount2 + " chips. Try again.");
chipCount = chipCount - playerTake;
Console.WriteLine("Chips left on table: " + chipCount);
comTake = random.Next(chipAmount2) + 1;
Console.WriteLine("My turn. I'm taking " + comTake + " chip(s).");
chipCount = chipCount - comTake;
Console.WriteLine("You won. Lucky.");
Console.WriteLine("I won because of my excellent skill.");
private static void input(out double result)
while (!double.TryParse(Console.ReadLine(), out result));
private static void input(out int result)
while (!int.TryParse(Console.ReadLine(), out result));
private static void input(out Boolean result)
while (!Boolean.TryParse(Console.ReadLine(), out result));
private static void input(out string result)
result = Console.ReadLine();