示例#1
0
        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;
                }
            }
        }
示例#2
0
 //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);
 }
示例#3
0
 //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);
 }
示例#4
0
 //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);
 }
示例#5
0
 //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);
 }
示例#6
0
 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");
     }
 }
示例#7
0
 private bool IsTopRow(RouletteElement element)
 {
     if (element.Value - 3 <= 0)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
示例#8
0
 private void RedorBlack(RouletteElement element)
 {
     if (element.Color == "Red")
     {
         Console.WriteLine("Red");
     }
     else if (element.Color == "Black")
     {
         Console.WriteLine("Black");
     }
 }
示例#9
0
 private bool IsThirdColumn(RouletteElement element)
 {
     if ((element.Value > 0) && (element.Value % 3 == 0))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
示例#10
0
        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);
            }
        }
示例#11
0
 private bool IsBottomRow(RouletteElement element)
 {
     if (element.Value + 3 >= 36)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
示例#12
0
        private bool IsSecondColumn(RouletteElement element)
        {
            if ((element.Value > 0) && ((element.Value - 2) % 3 == 0))
            {
                return(true);
            }

            else
            {
                return(false);
            }
        }
示例#13
0
        private void LowHigh(RouletteElement element)
        {
            int set = InGroupsOf(element, 18);

            if (set == 1)
            {
                Console.WriteLine("Low");
            }
            else if (set == 2)
            {
                Console.WriteLine("High");
            }
        }
示例#14
0
 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");
     }
 }
示例#15
0
        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);
        }
示例#16
0
        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");
        }
示例#17
0
        public void WinningBets(RouletteElement element)
        {
            WinningOptions wins = new WinningOptions();

            wins.PossibleWins(element);
        }
示例#18
0
 private void SetOfSix(RouletteElement element)
 {
     Console.WriteLine($"Set of Six number {InGroupsOf(element, 6)}");
 }
示例#19
0
 private void Street(RouletteElement element)
 {
     Console.WriteLine($"Street {InGroupsOf(element, 3)}");
 }
示例#20
0
 private void Dozens(RouletteElement element)
 {
     Console.WriteLine($"Dozen {InGroupsOf(element, 12)}");
 }
示例#21
0
 //Top
 private void TopSplit(RouletteElement element)
 {
     Console.WriteLine("Split on the top");
     //Console.WriteLine(element.Value);
     //Console.WriteLine(element.Value-3);
 }
示例#22
0
 //Left
 private void LeftSplit(RouletteElement element)
 {
     Console.WriteLine("Split on the left");
     //Console.WriteLine(element.Value);
     //Console.WriteLine(element.Value - 1);
 }
示例#23
0
 //Right
 private void RightSplit(RouletteElement element)
 {
     Console.WriteLine("Split on the right");
     //Console.WriteLine(element.Value);
     //Console.WriteLine(element.Value+1);
 }
示例#24
0
 //Bottom
 private void BottomSplit(RouletteElement element)
 {
     Console.WriteLine("Split on the bottom");
     //Console.WriteLine(element.Value);
     //Console.WriteLine(element.Value+3);
 }