static void Main(string[] args) { Console.WriteLine("Modeling a Roulette Wheel.\n"); Console.WriteLine("Welcome to The Mos Eisley Casino! We have the best roulette game in the galaxy!\n"); Console.WriteLine("Tell us about yourself since you seem to be new to this spaceport."); Console.Write("Please enter your name: "); string playerName = Console.ReadLine(); Console.Write($"Well, {playerName}, how many credits are you starting with today?: "); int playerCredits = Convert.ToInt32(Console.ReadLine()); Gambler player = new Gambler(playerName, playerCredits); RouletteGame.PlayRoulette(player); }
public static void KeepPlaying(Gambler player) { Console.WriteLine("You've still got some credits left, would you like to play again?\n"); Console.Write("Enter 1 to keep playing, of 0 to head back out into the galaxy: "); int playAgain = Convert.ToInt32(Console.ReadLine()); if (playAgain == 0) { Console.WriteLine($"Alright, don't get burned by the twin suns on your way out!"); } else if (playAgain == 1) { Console.WriteLine("Alright, another round coming right up!\n\n\n"); PlayRoulette(player); } }
public static void PlayRoulette(Gambler player) { Console.WriteLine("Let's play roulette! Let's first check your credit levels:"); player.DisplayCurrentCredits(); Console.WriteLine("Next, select a betting category:"); Console.WriteLine("\n#\tBet Type\tBet Payout"); Console.WriteLine("------------------------------------"); Console.WriteLine($"1)\tSingle Number\t\t35:1"); Console.WriteLine($"2)\tRed or Black\t\t1:1"); Console.WriteLine($"3)\tEvens or Odds\t\t2:1"); Console.WriteLine($"4)\tHigh or Low\t\t2:1"); Console.WriteLine($"5)\tStreet\t\t\t11:1"); Console.WriteLine($"6)\tSplit\t\t\t17:1"); Console.WriteLine($"7)\tDozens\t\t\t2:1"); Console.WriteLine($"8)\tDouble Rows\t\t8:1"); Console.WriteLine($"9)\tCorner\t\t\t8:1"); Console.WriteLine($"10)\tColumns\t\t\t2:1"); Console.Write("\n\nPlease enter the number of your desired betting category: "); int playerChoice = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("\n"); int choice = PickBettingOption(playerChoice); Console.WriteLine("\n"); IBet genericBet = new BetNumbers(0); IBet playerBet = GenerateBet(playerChoice, choice, genericBet); int wagerAmount = player.PlaceWager(); Console.Write("Let's review the details of the bet you have selected before spinning the roulette wheel. You have selected the following set of winning numbers/colors: \n\n"); playerBet.DisplayChosenBet(); Console.WriteLine("\n"); Console.WriteLine($"And you will be wagering {wagerAmount} on this bet."); Console.WriteLine("\n"); Continue(); int rouletteNumber = GetRouletteNumber(); (string spinResult, string spinResultColor) = SpinResult(rouletteNumber); Console.WriteLine($"\nThe winning number came out to be {spinResult}, which is a {spinResultColor} number.\n"); bool winningBet; if (playerChoice == 2) { winningBet = playerBet.EvaluateBet(spinResultColor); } else { winningBet = playerBet.EvaluateBet(spinResult); } int betMultiplier = GenerateBetMultiplier(playerChoice); int betResult = playerBet.EvaluateBetResult(winningBet, betMultiplier, wagerAmount); player.AdjustCredits(betResult); bool outOfCredits = player.GoBust(); Console.WriteLine("\n"); if (outOfCredits == true) { Console.WriteLine("You went completely bust on that bet! You'll be shipped out to Jaba's Palace to be fed to the Rancor!"); } else { KeepPlaying(player); } }