public static string ColumnsValidation(string valInput) { valInput = Regex.Replace(valInput, "[s]", string.Empty); if (valInput.Equals("column1")) { return(valInput); } if (valInput.Equals("column2")) { return(valInput); } if (valInput.Equals("column3")) { return(valInput); } else { WriteText.InvalidInputText(); WriteText.EnterChoice(); EvenOddValidation(Console.ReadLine()); } return(Regex.Replace(valInput, "[s]", string.Empty)); }
public int RedOrBlackBet(int spin) { WheelSpin wheel = new WheelSpin(); string redOrBlack; int winnings = 0; int bet = 0; int[] red = { 1, 3, 5, 7, 9, 12, 14, 16, 18, 19, 21, 23, 25, 27, 30, 32, 34, 36 }; int[] black = { 2, 4, 6, 8, 10, 11, 13, 15, 17, 20, 22, 24, 26, 28, 29, 31, 33, 35 }; int[] green = { 0, 37 }; WriteText.WriteLine("Red/Black Bet:", ConsoleColor.Yellow); WriteText.Write("Please Enter red or black: ", ConsoleColor.Red); redOrBlack = Console.ReadLine(); redOrBlack.ToLower(); WriteText.Write($"You have ${Player.money}. Please enter how much you would like to bet: ", ConsoleColor.Red); bet = Int32.Parse(Console.ReadLine()); if (bet > Player.money) { throw new System.IndexOutOfRangeException("You bet more than you have."); } if (bet <= Player.money) { wheel.displayWheel(); Player.money = Player.money - bet; if (red.Contains(spin) && redOrBlack == "red") { winnings = 2 * bet; Player.money = winnings + Player.money; WriteText.WriteLine($"The spin was {spin} red.", ConsoleColor.Green); WriteText.WriteLine($"You won ${winnings}. You now have ${Player.money}.", ConsoleColor.Green); } if (red.Contains(spin) && redOrBlack != "red") { WriteText.WriteLine($"The spin was {spin} red.", ConsoleColor.Red); WriteText.WriteLine($"You lost ${bet}. You now have ${Player.money}.", ConsoleColor.Red); } if (black.Contains(spin) && redOrBlack == "black") { winnings = 2 * bet; Player.money = winnings + Player.money; WriteText.WriteLine($"The spin was {spin} black.", ConsoleColor.Green); WriteText.WriteLine($"You won ${winnings}. You now have ${Player.money}.", ConsoleColor.Green); } if (black.Contains(spin) && redOrBlack != "black") { WriteText.WriteLine($"The spin was {spin} black.", ConsoleColor.Red); WriteText.WriteLine($"You lost ${bet}. You now have ${Player.money}.", ConsoleColor.Red); } if (spin == 0 || spin == 00) { WriteText.WriteLine($"The spin was {spin} green.", ConsoleColor.Red); WriteText.WriteLine($"You lost ${bet}. You now have ${Player.money}.", ConsoleColor.Red); } } return(Player.money); }
public int NumbersBet(int spin) { WheelSpin wheel = new WheelSpin(); int bet = 0; int number = 0; int winnings = 0; int[] red = { 1, 3, 5, 7, 9, 12, 14, 16, 18, 19, 21, 23, 25, 27, 30, 32, 34, 36 }; int[] black = { 2, 4, 6, 8, 10, 11, 13, 15, 17, 20, 22, 24, 26, 28, 29, 31, 33, 35 }; int[] green = { 0, 37 }; WriteText.WriteLine("Number Bet:", ConsoleColor.Yellow); WriteText.Write("Please enter the number you would like to bet on up to 36: ", ConsoleColor.Red); number = Int32.Parse(Console.ReadLine()); WriteText.Write($"You have ${Player.money}. Please enter how much you would like to bet: ", ConsoleColor.Red); bet = Int32.Parse(Console.ReadLine()); if (bet > Player.money) { throw new System.IndexOutOfRangeException("You bet more than you have."); } if (bet <= Player.money) { wheel.displayWheel(); Player.money = Player.money - bet; if (red.Contains(spin)) { WriteText.WriteLine($"The spin was {spin} red.", ConsoleColor.Red); } if (black.Contains(spin)) { WriteText.WriteLine($"The spin was {spin} black.", ConsoleColor.Red); } if (green.Contains(spin)) { if (spin == 00) { WriteText.WriteLine($"The spin was {spin} green.", ConsoleColor.Red); } else { WriteText.WriteLine($"The spin was {spin} green.", ConsoleColor.Red); } } if (spin == number) { winnings = 35 * bet; Player.money = winnings + Player.money; WriteText.WriteLine($"You won ${winnings}. You now have ${Player.money}.", ConsoleColor.Green); } if (spin != number) { WriteText.WriteLine($"You lost ${bet}. You now have ${Player.money}.", ConsoleColor.Red); } } return(Player.money); }
public static int NumbersChoiceValidation(int valInput) { while (valInput < 0 || valInput > 36) { WriteText.InvalidInputText(); WriteText.EnterChoice(); valInput = NumberValidation(Console.ReadLine()); } return(valInput); }
// Use to make sure the user is entering a cash amount above zero // Also rechecks to make sure the user is only entering numbers public static int InRangeCashAmount(int valInput) { while (valInput < 0) { WriteText.InvalidAmount(); WriteText.EnterAmount(); valInput = NumberValidation(Console.ReadLine()); } return(valInput); }
public void DisplayTable() { WriteText.WriteLine(" +--------------------------------------------------------+ C", ConsoleColor.DarkYellow); WriteText.WriteLine(" | 3 | 6 | 9 | 12 | 15 | 18 | 21 | 24 | 27 | 30 | 33 | 36 | 3 --> O", ConsoleColor.DarkYellow); WriteText.WriteLine("+---+ -------------------------------------------------------| L", ConsoleColor.DarkYellow); WriteText.WriteLine("| 0 | 2 | 5 | 8 | 11 | 14 | 17 | 20 | 23 | 26 | 29 | 32 | 35 | 2 --> U", ConsoleColor.DarkYellow); WriteText.WriteLine("+ --+--------------------------------------------------------| M", ConsoleColor.DarkYellow); WriteText.WriteLine(" | 1 | 4 | 7 | 10 | 13 | 16 | 19 | 22 | 25 | 28 | 31 | 34 | 1 --> N", ConsoleColor.DarkYellow); WriteText.WriteLine(" + -------------------------------------------------------+ S", ConsoleColor.DarkYellow); WriteText.WriteLine(" | | | |", ConsoleColor.DarkYellow); WriteText.WriteLine(" | 1st 12 | 2nd 12 | 3rd 12 |", ConsoleColor.DarkYellow); WriteText.WriteLine(" +----------------+-------------------+-------------------+", ConsoleColor.DarkYellow); }
public void DisplayTitle() { WriteText.WriteLine($"******* ** ** ** ", ConsoleColor.Red); WriteText.WriteLine($"/**////** /** /** /** ", ConsoleColor.Red); WriteText.WriteLine($"/** /** ****** ** ** /** ***** ****** ****** *****", ConsoleColor.Red); WriteText.WriteLine($"/******* **////**/** /** /** **///**///**/ ///**/ **///**", ConsoleColor.Red); WriteText.WriteLine($"/**///** /** /**/** /** /**/******* /** /** /*******", ConsoleColor.Red); WriteText.WriteLine($"/** //** /** /**/** /** /**/**//// /** /** /**//// ", ConsoleColor.Red); WriteText.WriteLine($"/** //**//****** //****** ***//****** //** //** //******", ConsoleColor.Red); WriteText.WriteLine($"// // ////// ////// /// ////// // // //////", ConsoleColor.Red); WriteText.WriteLine(""); WriteText.WriteLine(""); WriteText.WriteLine(""); WriteText.WriteLine("Press any key to continue: Goodluck!", ConsoleColor.Red); }
public static bool YesOrNo(string input) { if (input.ToLower() == "yes") { return(true); } if (input.ToLower() == "no") { return(false); } else { WriteText.InvalidInputText(); WriteText.TypesYesOrNo(); YesOrNo(Console.ReadLine()); } return(true); }
// This is to validate that the user is not trying to enter an yletters // nor enter any values below zero or above nine public static int NumberValidation(string valInput) { string userInput; int newInput; bool keepGoing = false; do { keepGoing = int.TryParse(valInput, out newInput); if (!keepGoing) { WriteText.InvalidInputText(); WriteText.EnterChoice(); userInput = Console.ReadLine(); keepGoing = int.TryParse(userInput, out newInput); //keepGoing = InRangeValidation(newInput); } } while (!keepGoing); return(newInput); }
public static string DozensValidation(string valInput) { if (valInput.Equals("first")) { return(valInput); } if (valInput.Equals("second")) { return(valInput); } if (valInput.Equals("third")) { return(valInput); } else { WriteText.InvalidInputText(); WriteText.EnterChoice(); EvenOddValidation(Console.ReadLine()); } return(valInput); }
public int EvenOrOddBet(int spin) { WheelSpin wheel = new WheelSpin(); string evenOrOdd; int winnings = 0; int bet = 0; int[] red = { 1, 3, 5, 7, 9, 12, 14, 16, 18, 19, 21, 23, 25, 27, 30, 32, 34, 36 }; int[] black = { 2, 4, 6, 8, 10, 11, 13, 15, 17, 20, 22, 24, 26, 28, 29, 31, 33, 35 }; int[] green = { 0, 37 }; WriteText.WriteLine("Evens/Odds Bet:", ConsoleColor.Yellow); WriteText.Write("Please enter even or odd ", ConsoleColor.Red); evenOrOdd = Console.ReadLine(); evenOrOdd.ToLower(); WriteText.Write($"You have ${Player.money}. Please enter how much you would like to bet: ", ConsoleColor.Red); bet = Int32.Parse(Console.ReadLine()); if (bet > Player.money) { throw new System.IndexOutOfRangeException("You bet more than you have."); } if (bet <= Player.money) { wheel.displayWheel(); Player.money = Player.money - bet; if (red.Contains(spin)) { WriteText.WriteLine($"The spin was {spin} red.", ConsoleColor.Red); } if (black.Contains(spin)) { WriteText.WriteLine($"The spin was {spin} black.", ConsoleColor.Red); } if (green.Contains(spin)) { if (spin == 00) { WriteText.WriteLine($"The spin was {spin} green.", ConsoleColor.Red); } else { WriteText.WriteLine($"The spin was {spin} green.", ConsoleColor.Red); } } if (spin % 2 == 0 && evenOrOdd == "even") { winnings = bet * 2; Player.money = winnings + Player.money; WriteText.WriteLine($"You won ${winnings}. You now have ${Player.money}.", ConsoleColor.Green); } else if (spin % 2 == 1 && evenOrOdd == "odd") { winnings = bet * 2; Player.money = winnings + Player.money; WriteText.WriteLine($"You won ${winnings}. You now have ${Player.money}.", ConsoleColor.Green); } else { WriteText.WriteLine($"You lost ${bet}. You now have ${Player.money}.", ConsoleColor.Red); } } return(Player.money); }
public PlayGame() { WriteText.StartGameText(); QuitGame(!Menu.YesOrNo(Console.ReadLine())); Console.Clear(); RouletteWheel[] gameWheel = RouletteWheel.ConstructWheel(); RouletteWheel binResult; ConsoleSpinner spinner = new ConsoleSpinner(); spinner.Delay = 300; Stopwatch s = new Stopwatch(); int time = 7; int userBetSelection; int intChoice; string stringChoice; int moneyBet; bool userDecision = true; WriteText.EnterAmountOfMoney(); Player user = new Player(Validation.InRangeCashAmount(UserInput.GetNumber())); Console.Clear(); // Loop will keep running as long as the user keeps sayin yes to new bets while (userDecision) { // I will be getting the spin result from the start in order for my bet methods to work properly // When the wheel spins in code, it doesn't matter to the user // I'll display wheel spinning after bets are placed // to make the user think the wheel spun after bets are placed binResult = RouletteWheel.SpinWheel(gameWheel); List <int> ListOfBetResults = new List <int>(); // once user tpyes no at the end of the loop it will then exit the loop while (userDecision) { Console.Clear(); GameBoard.DrawBoard(); WriteText.TypesOfBetsText(); WriteText.GetBetChoice(); userBetSelection = UserInput.GetNumber(); // Once a user picks a number the switch will pick the correct bet // Each case will draw a board and output how to bet // The bet is placed, then determines if its a win or lose then adds the money to a list to be added later switch (userBetSelection) { case 1: Console.Clear(); GameBoard.DrawBoard(); WriteText.NumbersChoice(); WriteText.EnterChoice(); intChoice = Validation.NumbersChoiceValidation(UserInput.GetNumber()); WriteText.EnterBetAmount(); moneyBet = Validation.InRangeCashAmount(UserInput.GetNumber()); ListOfBetResults.Add(user.PlaceMoneyBet(moneyBet, Bet.Number(intChoice, binResult.BinNumber))); break; case 2: Console.Clear(); GameBoard.DrawBoard(); WriteText.EvensOddsChoice(); WriteText.EnterChoice(); stringChoice = Validation.EvenOddValidation(UserInput.GetString()); WriteText.EnterBetAmount(); moneyBet = Validation.InRangeCashAmount(UserInput.GetNumber()); ListOfBetResults.Add(user.PlaceMoneyBet(moneyBet, Bet.EvensOdds(stringChoice, binResult.BinNumber))); break; case 3: Console.Clear(); GameBoard.DrawBoard(); WriteText.RedsBlacksChoice(); WriteText.EnterChoice(); stringChoice = Validation.RedBlackValidation(UserInput.GetString()); WriteText.EnterBetAmount(); moneyBet = Validation.InRangeCashAmount(UserInput.GetNumber()); ListOfBetResults.Add(user.PlaceMoneyBet(moneyBet, Bet.RedsBlacks(stringChoice, binResult.BinColor))); break; case 4: Console.Clear(); GameBoard.DrawBoard(); WriteText.LowsHighsChoice(); WriteText.EnterChoice(); stringChoice = Validation.LowHighValidation(UserInput.GetString()); WriteText.EnterBetAmount(); moneyBet = Validation.InRangeCashAmount(UserInput.GetNumber()); ListOfBetResults.Add(user.PlaceMoneyBet(moneyBet, Bet.LowsHighs(stringChoice, binResult.BinNumber))); break; case 5: Console.Clear(); GameBoard.DrawBoard(); WriteText.DozensChoice(); WriteText.EnterChoice(); stringChoice = Validation.DozensValidation(UserInput.GetString()); WriteText.EnterBetAmount(); moneyBet = Validation.InRangeCashAmount(UserInput.GetNumber()); ListOfBetResults.Add(user.PlaceMoneyBet(moneyBet, Bet.Dozens(stringChoice, binResult.BinNumber))); break; case 6: Console.Clear(); GameBoard.DrawBoard(); WriteText.ColumnsChoice(); WriteText.EnterChoice(); stringChoice = Validation.DozensValidation(UserInput.GetString()); WriteText.EnterBetAmount(); moneyBet = Validation.InRangeCashAmount(UserInput.GetNumber()); ListOfBetResults.Add(user.PlaceMoneyBet(moneyBet, Bet.Columns(stringChoice, binResult.BinNumber))); break; case 7: Console.Clear(); GameBoard.DrawBoard(); WriteText.StreetChoice(); WriteText.EnterChoice(); intChoice = Validation.StreetValidation(UserInput.GetNumber()); WriteText.EnterBetAmount(); moneyBet = Validation.InRangeCashAmount(UserInput.GetNumber()); ListOfBetResults.Add(user.PlaceMoneyBet(moneyBet, Bet.Street(intChoice, binResult.BinNumber))); break; case 8: Console.Clear(); GameBoard.DrawBoard(); WriteText.SixNumbersChoice(); WriteText.EnterChoice(); intChoice = UserInput.GetNumber(); WriteText.EnterBetAmount(); moneyBet = Validation.InRangeCashAmount(UserInput.GetNumber()); ListOfBetResults.Add(user.PlaceMoneyBet(moneyBet, Bet.SixNumbers(intChoice, binResult.BinNumber))); break; case 9: Console.Clear(); GameBoard.DrawBoard(); WriteText.SplitChoice(); WriteText.EnterChoice(); intChoice = UserInput.GetNumber(); WriteText.EnterBetAmount(); moneyBet = Validation.InRangeCashAmount(UserInput.GetNumber()); ListOfBetResults.Add(user.PlaceMoneyBet(moneyBet, Bet.Split(intChoice, binResult.BinNumber))); break; case 10: Console.Clear(); GameBoard.DrawBoard(); WriteText.Corners(); WriteText.EnterChoice(); intChoice = UserInput.GetNumber(); WriteText.EnterBetAmount(); moneyBet = Validation.InRangeCashAmount(UserInput.GetNumber()); ListOfBetResults.Add(user.PlaceMoneyBet(moneyBet, Bet.Corner(intChoice, binResult.BinNumber))); break; } Console.Clear(); WriteText.AskIfMoreBets(); userDecision = Menu.YesOrNo(UserInput.GetString()); Console.Clear(); s.Start(); Console.Write("Wheel Spinning"); while (s.Elapsed <= TimeSpan.FromSeconds(time)) { spinner.Turn(displayMsg: "Wheel spinning ", sequenceCode: 4); } s.Stop(); } Console.Clear(); int addWinningLosses = 0; // This loop will add up all the winning and losing bets foreach (var betMoney in ListOfBetResults) { addWinningLosses += betMoney; } if (addWinningLosses > 0) { WriteText.WonBet(); Console.WriteLine(addWinningLosses); } if (addWinningLosses < 0) { WriteText.LostBet(); Console.WriteLine(addWinningLosses); } if (addWinningLosses.Equals(0)) { WriteText.BrokeEven(); Console.WriteLine(addWinningLosses); } WriteText.NewCashAmount(); Console.WriteLine(user.AfterBetCashAmount(addWinningLosses)); addWinningLosses = 0; WriteText.KeepPlaying(); userDecision = Menu.YesOrNo(UserInput.GetString()); } }
public int DozensBet(int spin) { WheelSpin wheel = new WheelSpin(); string dozen; int winnings = 0; int bet = 0; int[] red = { 1, 3, 5, 7, 9, 12, 14, 16, 18, 19, 21, 23, 25, 27, 30, 32, 34, 36 }; int[] black = { 2, 4, 6, 8, 10, 11, 13, 15, 17, 20, 22, 24, 26, 28, 29, 31, 33, 35 }; int[] green = { 0, 37 }; WriteText.Write("For dozen (1-12) type first:\n" + "For dozen (13-24) type second:\n" + "For dozen (25-36) type third:", ConsoleColor.Red); dozen = Console.ReadLine(); dozen.ToLower(); WriteText.Write($"You have ${Player.money}. Please enter how much you would like to bet: ", ConsoleColor.Red); bet = Int32.Parse(Console.ReadLine()); if (bet > Player.money) { throw new System.IndexOutOfRangeException("You bet more than you have."); } if (bet <= Player.money) { wheel.displayWheel(); Player.money = Player.money - bet; if (red.Contains(spin)) { if (spin <= 12 && spin >= 1 && dozen == "first") { winnings = 3 * bet; Player.money = winnings + Player.money; WriteText.WriteLine($"The spin was {spin} red.", ConsoleColor.Green); WriteText.WriteLine($"You won ${winnings}. You now have ${Player.money}.", ConsoleColor.Green); } if (spin <= 12 && spin >= 1 && dozen != "first") { WriteText.WriteLine($"The spin was {spin} red.", ConsoleColor.Red); WriteText.WriteLine($"You lost ${bet}. You now have ${Player.money}.", ConsoleColor.Red); } if (spin >= 13 && spin <= 24 && dozen == "second") { winnings = 3 * bet; Player.money = winnings + Player.money; WriteText.WriteLine($"The spin was {spin} red.", ConsoleColor.Green); WriteText.WriteLine($"You won ${winnings}. You now have ${Player.money}.", ConsoleColor.Green); } if (spin >= 13 && spin <= 24 && dozen != "second") { WriteText.WriteLine($"The spin was {spin} red.", ConsoleColor.Red); WriteText.WriteLine($"You lost ${bet}. You now have ${Player.money}.", ConsoleColor.Red); } if (spin >= 25 && spin <= 36 && dozen == "third") { winnings = 3 * bet; Player.money = winnings + Player.money; WriteText.WriteLine($"The spin was {spin} red.", ConsoleColor.Green); WriteText.WriteLine($"You won ${winnings}. You now have ${Player.money}.", ConsoleColor.Green); } if (spin >= 25 && spin <= 36 && dozen != "third") { WriteText.WriteLine($"The spin was {spin} red.", ConsoleColor.Red); WriteText.WriteLine($"You lost ${bet}. You now have ${Player.money}.", ConsoleColor.Red); } } if (black.Contains(spin)) { if (spin <= 12 && spin >= 1 && dozen == "first") { winnings = 3 * bet; Player.money = winnings + Player.money; WriteText.WriteLine($"The spin was {spin} black.", ConsoleColor.Green); WriteText.WriteLine($"You won ${winnings}. You now have ${Player.money}.", ConsoleColor.Green); } if (spin <= 12 && spin >= 1 && dozen != "first") { WriteText.WriteLine($"The spin was {spin} black.", ConsoleColor.Red); WriteText.WriteLine($"You lost ${bet}. You now have ${Player.money}.", ConsoleColor.Red); } if (spin >= 13 && spin <= 24 && dozen == "second") { winnings = 3 * bet; Player.money = winnings + Player.money; WriteText.WriteLine($"The spin was {spin} black.", ConsoleColor.Green); WriteText.WriteLine($"You won ${winnings}. You now have ${Player.money}.", ConsoleColor.Green); } if (spin >= 13 && spin <= 24 && dozen != "second") { WriteText.WriteLine($"The spin was {spin} black.", ConsoleColor.Red); WriteText.WriteLine($"You lost ${bet}. You now have ${Player.money}.", ConsoleColor.Red); } if (spin >= 25 && spin <= 36 && dozen == "third") { winnings = 3 * bet; Player.money = winnings + Player.money; WriteText.WriteLine($"The spin was {spin} black.", ConsoleColor.Green); WriteText.WriteLine($"You won ${winnings}. You now have ${Player.money}.", ConsoleColor.Green); } if (spin >= 25 && spin <= 36 && dozen != "third") { WriteText.WriteLine($"The spin was {spin} black.", ConsoleColor.Red); WriteText.WriteLine($"You lost ${bet}. You now have ${Player.money}.", ConsoleColor.Red); } } if (spin == 0 || spin == 00) { WriteText.WriteLine($"The spin was {spin} green.", ConsoleColor.Red); WriteText.WriteLine($"You lost ${bet}. You now have ${Player.money}.", ConsoleColor.Red); } } return(Player.money); }
public int LowOrHighBet(int spin) { WheelSpin wheel = new WheelSpin(); string lowOrHigh; int winnings = 0; int bet = 0; int[] red = { 1, 3, 5, 7, 9, 12, 14, 16, 18, 19, 21, 23, 25, 27, 30, 32, 34, 36 }; int[] black = { 2, 4, 6, 8, 10, 11, 13, 15, 17, 20, 22, 24, 26, 28, 29, 31, 33, 35 }; int[] green = { 0, 37 }; WriteText.WriteLine("Lows/Highs Bet:", ConsoleColor.Yellow); WriteText.Write("lows (1-18) or highs (19-36)? Please enter low/high: ", ConsoleColor.Red); lowOrHigh = Console.ReadLine(); lowOrHigh.ToLower(); WriteText.Write($"You have ${Player.money}. Please enter how much you would like to bet: ", ConsoleColor.Red); bet = Int32.Parse(Console.ReadLine()); if (bet > Player.money) { throw new System.IndexOutOfRangeException("You bet more than you have."); } if (bet <= Player.money) { wheel.displayWheel(); if (red.Contains(spin)) { Player.money = Player.money - bet; if (spin <= 18 && spin >= 1 && lowOrHigh == "low") { winnings = 2 * bet; Player.money = winnings + Player.money; WriteText.WriteLine($"The spin was {spin} red.", ConsoleColor.Green); WriteText.WriteLine($"You won ${winnings}. You now have ${Player.money}.", ConsoleColor.Green); } if (spin <= 18 && spin >= 1 && lowOrHigh != "low") { WriteText.WriteLine($"The spin was {spin} red.", ConsoleColor.Red); WriteText.WriteLine($"You lost ${bet}. You now have ${Player.money}.", ConsoleColor.Red); } if (spin >= 19 && lowOrHigh == "high") { winnings = 2 * bet; Player.money = winnings + Player.money; WriteText.WriteLine($"The spin was {spin} red.", ConsoleColor.Green); WriteText.WriteLine($"You won ${winnings}. You now have ${Player.money}.", ConsoleColor.Green); } if (spin >= 19 && lowOrHigh != "high") { WriteText.WriteLine($"The spin was {spin} red.", ConsoleColor.Red); WriteText.WriteLine($"You lost ${bet}. You now have ${Player.money}.", ConsoleColor.Red); } if (spin == 0 || spin == 00) { WriteText.WriteLine($"The spin was {spin} red.", ConsoleColor.Red); WriteText.WriteLine($"You lost ${bet}. You now have ${Player.money}.", ConsoleColor.Red); } } if (black.Contains(spin)) { Player.money = Player.money - bet; if (spin <= 18 && spin >= 1 && lowOrHigh == "low") { winnings = 2 * bet; Player.money = winnings + Player.money; WriteText.WriteLine($"The spin was {spin} black.", ConsoleColor.Green); WriteText.WriteLine($"You won ${winnings}. You now have ${Player.money}.", ConsoleColor.Green); } if (spin <= 18 && spin >= 1 && lowOrHigh != "low") { WriteText.WriteLine($"The spin was {spin} black.", ConsoleColor.Red); WriteText.WriteLine($"You lost ${bet}. You now have ${Player.money}.", ConsoleColor.Red); } if (spin >= 19 && lowOrHigh == "high") { winnings = 2 * bet; Player.money = winnings + Player.money; WriteText.WriteLine($"The spin was {spin} black.", ConsoleColor.Green); WriteText.WriteLine($"You won ${winnings}. You now have ${Player.money}.", ConsoleColor.Green); } if (spin >= 19 && lowOrHigh != "high") { WriteText.WriteLine($"The spin was {spin} black.", ConsoleColor.Red); WriteText.WriteLine($"You lost ${bet}. You now have ${Player.money}.", ConsoleColor.Red); } } if (green.Contains(spin)) { if (spin == 0 || spin == 00) { WriteText.WriteLine($"The spin was {spin} green.", ConsoleColor.Red); WriteText.WriteLine($"You lost ${bet}. You now have ${Player.money}.", ConsoleColor.Red); } } } return(Player.money); }
public int ColumnBet(int spin) { WheelSpin wheel = new WheelSpin(); string column; int winnings = 0; int bet = 0; int[] red = { 1, 3, 5, 7, 9, 12, 14, 16, 18, 19, 21, 23, 25, 27, 30, 32, 34, 36 }; int[] black = { 2, 4, 6, 8, 10, 11, 13, 15, 17, 20, 22, 24, 26, 28, 29, 31, 33, 35 }; int[] green = { 0, 37 }; int[] column1 = { 1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 34 }; int[] column2 = { 2, 5, 8, 11, 14, 17, 20, 23, 26, 29, 32, 35 }; int[] column3 = { 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36 }; WriteText.WriteLine("Column Bet:", ConsoleColor.Yellow); WriteText.WriteLine("Please Enter number (1) (2) or (3) See board above (1:Bottom, 2:Middle, 3:Top)", ConsoleColor.Red); column = Console.ReadLine(); column.ToLower(); WriteText.WriteLine($"You have ${Player.money}. Please enter how much you would like to bet: ", ConsoleColor.Red); bet = Int32.Parse(Console.ReadLine()); if (bet > Player.money) { throw new System.IndexOutOfRangeException("You bet more than you have."); } if (bet <= Player.money) { wheel.displayWheel(); Player.money = Player.money - bet; if (red.Contains(spin)) { if (column1.Contains(spin) && column == "first") { winnings = 3 * bet; Player.money = winnings + Player.money; WriteText.WriteLine($"The spin was {spin} red.", ConsoleColor.Green); WriteText.WriteLine($"You won ${winnings}. You now have ${Player.money}.", ConsoleColor.Green); } if (column1.Contains(spin) && column != "first") { WriteText.WriteLine($"The spin was {spin} red.", ConsoleColor.Red); WriteText.WriteLine($"You lost ${bet}. You now have ${Player.money}.", ConsoleColor.Red); } if (column2.Contains(spin) && column == "second") { winnings = 3 * bet; Player.money = winnings + Player.money; WriteText.WriteLine($"The spin was {spin} red.", ConsoleColor.Green); WriteText.WriteLine($"You won ${winnings}. You now have ${Player.money}.", ConsoleColor.Green); } if (column2.Contains(spin) && column != "second") { WriteText.WriteLine($"The spin was {spin} red.", ConsoleColor.Red); WriteText.WriteLine($"You lost ${bet}. You now have ${Player.money}.", ConsoleColor.Red); } if (column3.Contains(spin) && column == "third") { winnings = 3 * bet; Player.money = winnings + Player.money; WriteText.WriteLine($"The spin was {spin} red.", ConsoleColor.Green); WriteText.WriteLine($"You won ${winnings}. You now have ${Player.money}.", ConsoleColor.Green); } if (column3.Contains(spin) && column != "third") { WriteText.WriteLine($"The spin was {spin} red.", ConsoleColor.Red); WriteText.WriteLine($"You lost ${bet}. You now have ${Player.money}.", ConsoleColor.Red); } } if (black.Contains(spin)) { if (column1.Contains(spin) && column == "first") { winnings = 3 * bet; Player.money = winnings + Player.money; WriteText.WriteLine($"The spin was {spin} black.", ConsoleColor.Green); WriteText.WriteLine($"You won ${winnings}. You now have ${Player.money}.", ConsoleColor.Green); } if (column1.Contains(spin) && column != "first") { WriteText.WriteLine($"The spin was {spin} black.", ConsoleColor.Red); WriteText.WriteLine($"You lost ${bet}. You now have ${Player.money}.", ConsoleColor.Red); } if (column2.Contains(spin) && column == "second") { winnings = 3 * bet; Player.money = winnings + Player.money; WriteText.WriteLine($"The spin was {spin} black.", ConsoleColor.Green); WriteText.WriteLine($"You won ${winnings}. You now have ${Player.money}.", ConsoleColor.Green); } if (column2.Contains(spin) && column != "second") { WriteText.WriteLine($"The spin was {spin} black.", ConsoleColor.Red); WriteText.WriteLine($"You lost ${bet}. You now have ${Player.money}.", ConsoleColor.Red); } if (column3.Contains(spin) && column == "third") { winnings = 3 * bet; Player.money = winnings + Player.money; WriteText.WriteLine($"The spin was {spin} black.", ConsoleColor.Green); WriteText.WriteLine($"You won ${winnings}. You now have ${Player.money}.", ConsoleColor.Green); } if (column3.Contains(spin) && column != "third") { WriteText.WriteLine($"The spin was {spin} black.", ConsoleColor.Red); WriteText.WriteLine($"You lost ${bet}. You now have ${Player.money}.", ConsoleColor.Red); } } if (spin == 0 || spin == 00) { WriteText.WriteLine($"The spin was {spin} green.", ConsoleColor.Red); WriteText.WriteLine($"You lost ${bet}. You now have ${Player.money}.", ConsoleColor.Red); } } return(Player.money); }
public int CornerBet(int spin) { WheelSpin wheel = new WheelSpin(); int cornerNumber; int winnings = 0; int bet = 0; bool win = false; int[] red = { 1, 3, 5, 7, 9, 12, 14, 16, 18, 19, 21, 23, 25, 27, 30, 32, 34, 36 }; int[] black = { 2, 4, 6, 8, 10, 11, 13, 15, 17, 20, 22, 24, 26, 28, 29, 31, 33, 35 }; int[] green = { 0, 37 }; int[] column1 = { 1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 34 }; int[] column2 = { 2, 5, 8, 11, 14, 17, 20, 23, 26, 29, 32, 35 }; int[] column3 = { 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36 }; int[] PlayerCorner = new int[4]; WriteText.WriteLine("Corner Bet:", ConsoleColor.Yellow); WriteText.Write("Select the number that will be located at the bottom left corner of your square: ", ConsoleColor.Red); cornerNumber = Int32.Parse(Console.ReadLine()); if (column1.Contains(cornerNumber) || column2.Contains(cornerNumber)) { PlayerCorner[0] = cornerNumber; PlayerCorner[1] = cornerNumber + 1; PlayerCorner[2] = cornerNumber + 3; PlayerCorner[3] = cornerNumber + 4; } if (column3.Contains(cornerNumber)) { PlayerCorner[0] = cornerNumber; PlayerCorner[1] = cornerNumber - 1; PlayerCorner[2] = cornerNumber + 3; PlayerCorner[3] = cornerNumber + 2; } WriteText.Write($"You have ${Player.money}. Please enter how much you would like to bet: ", ConsoleColor.Red); bet = Int32.Parse(Console.ReadLine()); if (bet > Player.money) { throw new System.IndexOutOfRangeException("You bet more than you have."); } if (bet <= Player.money) { wheel.displayWheel(); Player.money = Player.money - bet; if (red.Contains(spin)) { foreach (int i in PlayerCorner) { if (spin == i) { win = true; break; } if (spin != i) { win = false; } } if (win == true) { winnings = 8 * bet; Player.money = winnings + Player.money; WriteText.WriteLine($"The spin was {spin} red.", ConsoleColor.Green); WriteText.WriteLine($"You won ${winnings}. You now have ${Player.money}.", ConsoleColor.Green); } if (win == false) { WriteText.WriteLine($"The spin was {spin} red.", ConsoleColor.Red); WriteText.WriteLine($"You lost ${bet}. You now have ${Player.money}.", ConsoleColor.Red); } } if (black.Contains(spin)) { foreach (int i in PlayerCorner) { if (spin == i) { win = true; break; } if (spin != i) { win = false; } } if (win == true) { winnings = 8 * bet; Player.money = winnings + Player.money; WriteText.WriteLine($"The spin was {spin} black.", ConsoleColor.Green); WriteText.WriteLine($"You won ${winnings}. You now have ${Player.money}.", ConsoleColor.Green); } if (win == false) { WriteText.WriteLine($"The spin was {spin} black.", ConsoleColor.Red); WriteText.WriteLine($"You lost ${bet}. You now have ${Player.money}.", ConsoleColor.Red); } } if (spin == 0 || spin == 00) { WriteText.WriteLine($"The spin was {spin} green.", ConsoleColor.Red); WriteText.WriteLine($"You lost ${bet}. You now have ${Player.money}.", ConsoleColor.Red); } } return(Player.money); }
public int SixLineBet(int spin) { WheelSpin wheel = new WheelSpin(); int street; int rangeOfStreet; int winnings = 0; int bet = 0; int[] red = { 1, 3, 5, 7, 9, 12, 14, 16, 18, 19, 21, 23, 25, 27, 30, 32, 34, 36 }; int[] black = { 2, 4, 6, 8, 10, 11, 13, 15, 17, 20, 22, 24, 26, 28, 29, 31, 33, 35 }; int[] green = { 0, 37 }; WriteText.WriteLine("SixLine Bet:", ConsoleColor.Yellow); WriteText.Write("To select a specific two rows of numbers please enter the lowest number in the street you wish to choose: ", ConsoleColor.Red); street = Int32.Parse(Console.ReadLine()); rangeOfStreet = street + 5; WriteText.Write($"You have ${Player.money}. Please enter how much you would like to bet: ", ConsoleColor.Red); bet = Int32.Parse(Console.ReadLine()); if (bet > Player.money) { throw new System.IndexOutOfRangeException("You bet more than you have."); } if (bet <= Player.money) { wheel.displayWheel(); Player.money = Player.money - bet; if (red.Contains(spin)) { if (spin <= rangeOfStreet && spin >= 1) { winnings = 6 * bet; Player.money = winnings + Player.money; WriteText.WriteLine($"The spin was {spin} red.", ConsoleColor.Green); WriteText.WriteLine($"You won ${winnings}. You now have ${Player.money}.", ConsoleColor.Green); } if (spin > rangeOfStreet) { WriteText.WriteLine($"The spin was {spin} red.", ConsoleColor.Red); WriteText.WriteLine($"You lost ${bet}. You now have ${Player.money}.", ConsoleColor.Red); } } if (black.Contains(spin)) { if (spin <= rangeOfStreet && spin >= 1) { winnings = 6 * bet; Player.money = winnings + Player.money; WriteText.WriteLine($"The spin was {spin} black.", ConsoleColor.Green); WriteText.WriteLine($"You won ${winnings}. You now have ${Player.money}.", ConsoleColor.Green); } if (spin > rangeOfStreet) { WriteText.WriteLine($"The spin was {spin} black.", ConsoleColor.Red); WriteText.WriteLine($"You lost ${bet}. You now have ${Player.money}.", ConsoleColor.Red); } } if (spin == 0 || spin == 00) { WriteText.WriteLine($"The spin was {spin} green.", ConsoleColor.Red); WriteText.WriteLine($"You lost ${bet}. You now have ${Player.money}.", ConsoleColor.Red); } } return(Player.money); }
//Weather weather; public void Play() { bool play; string playAgain; //Moved this to the opening screen in program. //weather = new Weather(); //weather.SetRealWeatherAsync(); while (play = true && Player.money > 0) { Console.Clear(); DisplayTable(); WriteText.WriteLine(""); WriteText.WriteLine(""); WriteText.WriteLine(""); //Console.WriteLine("The Temperture today is {0} degrees and {1} today.", weather.Temperature, weather.WeatherEffect); WriteText.WriteLine($"Choose a number cooresponding to the bet you'd like to make\n" + $"1: bet on a number(1/36 odds)\t 2: Even or Odds(1/2 odds)\t 3: Red or Black(1/2 odds)\n" + $"4: Lows or Highs(1/2 odds)\t 5: Dozens(1/3 odds)\t 6: Column bet(1/3 odds)\n" + $"7: Street(1/12 odds)\t 8: six-line(1/6 odds)\t 9: Split(1/18 odds)\n" + $"10: Corner bet(1/9 odds)", ConsoleColor.Green); int chosenBet = Int32.Parse(Console.ReadLine()); if (chosenBet > 10) { throw new IndexOutOfRangeException("You chose a number that does not correspond with any of the bets."); } if (chosenBet == 1) { Number number = new Number(); number.NumbersBet(Spin()); } if (chosenBet == 2) { EvenOrOdd evenorodd = new EvenOrOdd(); evenorodd.EvenOrOddBet(Spin()); } if (chosenBet == 3) { RedOrBlack redorblack = new RedOrBlack(); redorblack.RedOrBlackBet(Spin()); } if (chosenBet == 4) { LowsHighs loworhigh = new LowsHighs(); loworhigh.LowOrHighBet(Spin()); } if (chosenBet == 5) { Dozens dozens = new Dozens(); dozens.DozensBet(Spin()); } if (chosenBet == 6) { Columns columns = new Columns(); columns.ColumnBet(Spin()); } if (chosenBet == 7) { Street street = new Street(); street.StreetBet(Spin()); } if (chosenBet == 8) { SixLine sixLine = new SixLine(); sixLine.SixLineBet(Spin()); } if (chosenBet == 9) { Split split = new Split(); split.SplitBet(Spin()); } if (chosenBet == 10) { Corner corner = new Corner(); corner.CornerBet(Spin()); } if (Player.money == 0) { play = false; WriteText.WriteLine("Thank you for playing. Good bye.", ConsoleColor.Red); Console.ReadKey(); } if (Player.money > 0) { WriteText.WriteLine("Would you like to play again (yes/no): ", ConsoleColor.Red); playAgain = Console.ReadLine(); playAgain.ToLower(); if (playAgain == "yes") { play = true; Random random = new Random(); int phrase = random.Next(1, 3); if (phrase == 1) { WriteText.WriteLine("You'll certainly win more this time!", ConsoleColor.Red); } if (phrase == 2) { WriteText.WriteLine("Ah you like to live life on the edge. Fantastic lets play again!", ConsoleColor.Red); } if (phrase == 3) { WriteText.WriteLine("Luck is for the unskilled. You must be a very lucky person.", ConsoleColor.Red); } } else if (playAgain == "no") { play = false; WriteText.WriteLine("Thank you for playing. Good bye.", ConsoleColor.Red); Console.ReadKey(); } } } }
public int SplitBet(int spin) { WheelSpin wheel = new WheelSpin(); int splitNumber1; int splitNumber2 = 0; int winnings = 0; int bet = 0; int[] red = { 1, 3, 5, 7, 9, 12, 14, 16, 18, 19, 21, 23, 25, 27, 30, 32, 34, 36 }; int[] black = { 2, 4, 6, 8, 10, 11, 13, 15, 17, 20, 22, 24, 26, 28, 29, 31, 33, 35 }; int[] green = { 0, 37 }; int[] column1 = { 1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 34 }; int[] column2 = { 2, 5, 8, 11, 14, 17, 20, 23, 26, 29, 32, 35 }; int[] column3 = { 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36 }; WriteText.WriteLine("Split Bet:", ConsoleColor.Yellow); WriteText.Write("You are making a split bet. Select your first number: ", ConsoleColor.Red); splitNumber1 = Int32.Parse(Console.ReadLine()); if (column1.Contains(splitNumber1)) { if (splitNumber1 == 1) { WriteText.Write("Please enter the number you wish to split with (2, or 4): ", ConsoleColor.Red); splitNumber2 = Int32.Parse(Console.ReadLine()); } if (splitNumber1 == 34) { WriteText.Write("Please enter the number you wish to split with (31, or 35): ", ConsoleColor.Red); splitNumber2 = Int32.Parse(Console.ReadLine()); } if (splitNumber1 != 1 && splitNumber1 != 34) { WriteText.Write($"Please enter the number you wish to split with ({splitNumber1 - 3}, {splitNumber1 + 1}, or {splitNumber1 + 3}): ", ConsoleColor.Red); splitNumber2 = Int32.Parse(Console.ReadLine()); } } if (column2.Contains(splitNumber1)) { if (splitNumber1 == 2) { WriteText.Write("Please enter the number you wish to split with (1, 3, or 5): ", ConsoleColor.Red); splitNumber2 = Int32.Parse(Console.ReadLine()); } if (splitNumber1 == 35) { WriteText.Write("Please enter the number you wish to split with (32, 34, 36): ", ConsoleColor.Red); splitNumber2 = Int32.Parse(Console.ReadLine()); } if (splitNumber1 != 2 && splitNumber1 != 35) { WriteText.Write($"Please enter the number you wish to split with ({splitNumber1 - 3}, {splitNumber1 - 1}, {splitNumber1 + 1}, or {splitNumber1 + 3}): ", ConsoleColor.Red); splitNumber2 = Int32.Parse(Console.ReadLine()); } } if (column3.Contains(splitNumber1)) { if (splitNumber1 == 3) { WriteText.Write("Please enter the number you wish to split with (2, or 6): ", ConsoleColor.Red); splitNumber2 = Int32.Parse(Console.ReadLine()); } if (splitNumber1 == 36) { WriteText.Write("Please enter the number you wish to split with (33, or 35): ", ConsoleColor.Red); splitNumber2 = Int32.Parse(Console.ReadLine()); } if (splitNumber1 != 3 && splitNumber1 != 36) { WriteText.Write($"Please enter the number you wish to split with ({splitNumber1 - 3}, {splitNumber1 - 1}, or {splitNumber1 + 3}): ", ConsoleColor.Red); splitNumber2 = Int32.Parse(Console.ReadLine()); } } WriteText.Write($"You have ${Player.money}. Please enter how much you would like to bet: ", ConsoleColor.Red); bet = Int32.Parse(Console.ReadLine()); if (bet > Player.money) { throw new System.IndexOutOfRangeException("You bet more than you have."); } if (bet <= Player.money) { wheel.displayWheel(); Player.money = Player.money - bet; if (red.Contains(spin)) { if (spin == splitNumber1 || spin == splitNumber2) { winnings = 17 * bet; Player.money = winnings + Player.money; WriteText.WriteLine($"The spin was {spin} red.", ConsoleColor.Green); WriteText.WriteLine($"You won ${winnings}. You now have ${Player.money}.", ConsoleColor.Green); } if (spin != splitNumber1 || spin != splitNumber2) { WriteText.WriteLine($"The spin was {spin} red.", ConsoleColor.Red); WriteText.WriteLine($"You lost ${bet}. You now have ${Player.money}.", ConsoleColor.Red); } } if (black.Contains(spin)) { if (spin == splitNumber1 || spin == splitNumber2) { winnings = 17 * bet; Player.money = winnings + Player.money; WriteText.WriteLine($"The spin was {spin} black.", ConsoleColor.Green); WriteText.WriteLine($"You won ${winnings}. You now have ${Player.money}.", ConsoleColor.Green); } if (spin != splitNumber1 || spin != splitNumber2) { WriteText.WriteLine($"The spin was {spin} black.", ConsoleColor.Red); WriteText.WriteLine($"You lost ${bet}. You now have ${Player.money}.", ConsoleColor.Red); } } if (spin == 0 || spin == 00) { WriteText.WriteLine($"The spin was {spin} green.", ConsoleColor.Red); WriteText.WriteLine($"You lost ${bet}. You now have ${Player.money}.", ConsoleColor.Red); } } return(Player.money); }