static void doWork() { string headerText = "Press 'Space' to generate a spin or 'Escape' to exit\n"; Console.WriteLine(headerText); Random rand = new Random(); int randSelect = rand.Next(0, 37); RouletteWheel rwInst = new RouletteWheel(); RouletteElement selection = rwInst.rouletteWheel[randSelect]; ConsoleKeyInfo option = new ConsoleKeyInfo(); bool quit = false; while (!quit) { option = Console.ReadKey(); Console.Clear(); Console.WriteLine(headerText); switch (option.Key) { case ConsoleKey.Spacebar: selection = rwInst.rouletteWheel[randSelect]; randSelect = rand.Next(0, 38); rwInst.WinningBets(selection); break; case ConsoleKey.Escape: quit = true; Console.WriteLine("GoodBye"); break; } } }
//TopRight private void TopRightSplit(RouletteElement element) { Console.WriteLine("Split on the top-right corner"); //Console.WriteLine(element.Value); //Console.WriteLine(element.Value+1); //Console.WriteLine(element.Value-2); //Console.WriteLine(element.Value-3); }
//TopLeft private void TopLeftSplit(RouletteElement element) { Console.WriteLine("Split on the top-left corner"); //Console.WriteLine(element.Value); //Console.WriteLine(element.Value-1); //Console.WriteLine(element.Value-3); //Console.WriteLine(element.Value-4); }
//BottomRight private void BottomRightSplit(RouletteElement element) { Console.WriteLine("Split on the bottom-right corner"); //Console.WriteLine(element.Value); //Console.WriteLine(element.Value + 1); //Console.WriteLine(element.Value + 3); //Console.WriteLine(element.Value + 4); }
//BottomLeft private void BottomLeftSplit(RouletteElement element) { Console.WriteLine("Split on the bottom-left corner"); //Console.WriteLine(element.Value); //Console.WriteLine(element.Value-1); //Console.WriteLine(element.Value+2); //Console.WriteLine(element.Value+3); }
private void EvenorOdd(RouletteElement element) { if (element.Value > 0 && element.Value % 2 == 0) { Console.WriteLine("Even"); } else if (element.Value > 0 && element.Value % 2 == 1) { Console.WriteLine("Odd"); } }
private bool IsTopRow(RouletteElement element) { if (element.Value - 3 <= 0) { return(true); } else { return(false); } }
private void RedorBlack(RouletteElement element) { if (element.Color == "Red") { Console.WriteLine("Red"); } else if (element.Color == "Black") { Console.WriteLine("Black"); } }
private bool IsThirdColumn(RouletteElement element) { if ((element.Value > 0) && (element.Value % 3 == 0)) { return(true); } else { return(false); } }
private void SplitTest(RouletteElement element) { if (IsFirstColumn(element)) { if (!IsTopRow(element)) { TopSplit(element); TopRightSplit(element); } if (!IsBottomRow(element)) { BottomSplit(element); BottomRightSplit(element); } //no matter what RightSplit(element); } else if (IsSecondColumn(element)) { if (!IsTopRow(element)) { TopLeftSplit(element); TopSplit(element); TopRightSplit(element); } if (!IsBottomRow(element)) { BottomLeftSplit(element); BottomSplit(element); BottomRightSplit(element); } //no matter what RightSplit(element); LeftSplit(element); } else if (IsThirdColumn(element)) { if (!IsTopRow(element)) { TopLeftSplit(element); TopSplit(element); } if (!IsBottomRow(element)) { BottomLeftSplit(element); BottomSplit(element); } //no matter what LeftSplit(element); } }
private bool IsBottomRow(RouletteElement element) { if (element.Value + 3 >= 36) { return(true); } else { return(false); } }
private bool IsSecondColumn(RouletteElement element) { if ((element.Value > 0) && ((element.Value - 2) % 3 == 0)) { return(true); } else { return(false); } }
private void LowHigh(RouletteElement element) { int set = InGroupsOf(element, 18); if (set == 1) { Console.WriteLine("Low"); } else if (set == 2) { Console.WriteLine("High"); } }
private void Column(RouletteElement element) { if (IsFirstColumn(element)) { Console.WriteLine("Column 1"); } else if (IsSecondColumn(element)) { Console.WriteLine("Column 2"); } else if (IsThirdColumn(element)) { Console.WriteLine("Column 3"); } }
private int InGroupsOf(RouletteElement element, int group) //returns location of subset group { int inGroup = 0; if (element.Value > 0) { if (element.Value % group == 0) { inGroup = element.Value / group; } else { //floor to the next group (since the first group is group "Zero") inGroup = (((element.Value + group) - element.Value % group) / group); } } return(inGroup); }
public void PossibleWins(RouletteElement element) { Console.WriteLine($"Winning bets for {element.Name} Are: "); Console.WriteLine(element.Name); if (element.Value > 0) { EvenorOdd(element); RedorBlack(element); LowHigh(element); Dozens(element); Column(element); Street(element); SetOfSix(element); SplitTest(element); } Console.WriteLine("\n\n\n\n\n"); }
public void WinningBets(RouletteElement element) { WinningOptions wins = new WinningOptions(); wins.PossibleWins(element); }
private void SetOfSix(RouletteElement element) { Console.WriteLine($"Set of Six number {InGroupsOf(element, 6)}"); }
private void Street(RouletteElement element) { Console.WriteLine($"Street {InGroupsOf(element, 3)}"); }
private void Dozens(RouletteElement element) { Console.WriteLine($"Dozen {InGroupsOf(element, 12)}"); }
//Top private void TopSplit(RouletteElement element) { Console.WriteLine("Split on the top"); //Console.WriteLine(element.Value); //Console.WriteLine(element.Value-3); }
//Left private void LeftSplit(RouletteElement element) { Console.WriteLine("Split on the left"); //Console.WriteLine(element.Value); //Console.WriteLine(element.Value - 1); }
//Right private void RightSplit(RouletteElement element) { Console.WriteLine("Split on the right"); //Console.WriteLine(element.Value); //Console.WriteLine(element.Value+1); }
//Bottom private void BottomSplit(RouletteElement element) { Console.WriteLine("Split on the bottom"); //Console.WriteLine(element.Value); //Console.WriteLine(element.Value+3); }