public static void Main()
Console.WriteLine("Welcome to the Monty Hall game!");
static int Play(int coins)
Random rnd = new Random();
double cost = (Math.Floor(coins/ 100.0) * 10.0) + 10;
int[] doors = { 0, 0, 0 };
double prize = Math.Floor((coins + cost) / 5.0) * 5.0;
doors[rnd.Next(0, 3)] = 1;
int removedDoor = rnd.Next(0, 3);
Console.WriteLine("You currently have " + coins + " coins.");
Console.WriteLine("There are three doors, behind one is " + prize + " coins.");
Console.WriteLine("Would you like to play a round of the game, it will cost you " + cost + " coins. (Y/N)");
Console.WriteLine("Thank you for playing, your end score is : " + coins + ".");
coins -= Convert.ToInt32(cost);
Console.WriteLine("Which door do you think the prize is behind? (1/2/3)");
int guess = NumericalInput(1, 3) - 1;
while ((removedDoor == guess) | (doors[removedDoor] == 1))
removedDoor = rnd.Next(0, 3);
while ((otherDoor == guess) | (otherDoor == removedDoor))
Console.WriteLine("The host has opened door " + (removedDoor + 1) + ", behind it was nothing. ");
Console.WriteLine("Would you like to swap to door " + (otherDoor + 1) + "? (Y/N)");
Console.WriteLine("You have won the " + prize + " coins prize!");
return coins + Convert.ToInt32(prize);
Console.WriteLine("There was nothing behind the door, better luck next time.");
string response = Console.ReadLine().ToLower();
if (response[0] == Convert.ToChar("n"))
else if (response[0] == Convert.ToChar("y"))
Console.WriteLine("You did not enter Yes or No. Try again:");
static int NumericalInput(int start, int options)
{"zero", "one", "two", "three", "four"};
response = Console.ReadLine().ToLower();
if (ValidNumber(response))
responseNum = Convert.ToInt32(response);
position = Array.IndexOf(numWords, response);
responseNum = options + 10;
if ((responseNum >= start) & (responseNum <= options))
Console.WriteLine("You did not enter a number from " + start + " to " + options + ". Try again: ");
static bool ValidNumber(string number)
for (int i = 0; i < number.Length; i++)
if (char.IsDigit(number[i]) == false)