Beispiel #1
0
 /// <summary>
 /// Makes a bet on two or four adjacent *numbered* spaces at once, as though betting on an edge or corner.
 /// </summary>
 /// <param name="tableSpaces">The array of spaces to bet on. These should be references to TableSpaces from the RouletteTable object.
 /// This method assumes that if four spaces are passed, they will be passed in numerical order.</param>
 /// <param name="betAmount">The amount to be bet.</param>
 /// <returns>Returns true if the bet is valid.</returns>
 public bool MakeBet(TableSpace[] tableSpaces, Decimal betAmount)
 {
     if (tableSpaces.Length != 2 || tableSpaces.Length != 4)
     {
         return(false);
     }
     else if (tableSpaces.Length == 2)
     {
         // Check that these spaces are normal numbered spaces.
         if (tableSpaces[0].Value > 0 || tableSpaces[1].Value > 0)
         {
             return(false);
         }
         // The % 3 operation ensures that its not a wraparound.
         if ((tableSpaces[0].Value + 1 == tableSpaces[1].Value && tableSpaces[0].Value % 3 != 0) || (tableSpaces[0].Value - 1 == tableSpaces[1].Value && tableSpaces[1].Value % 3 != 0))
         {
             BetSpace  = new TableSpace(tableSpaces, 17);
             BetAmount = betAmount;
             return(true);
         }
         else
         {
             return(false);
         }
     }
     else
     {
         if (tableSpaces[0].Value > 0 || tableSpaces[1].Value > 0 || tableSpaces[2].Value > 0 || tableSpaces[3].Value > 0)
         {
             return(false);
         }
         if ((tableSpaces[0].Value + 1 == tableSpaces[1].Value && tableSpaces[0].Value % 3 != 0) || (tableSpaces[0].Value - 1 == tableSpaces[1].Value && tableSpaces[1].Value % 3 != 0))
         {
             if ((tableSpaces[2].Value + 1 == tableSpaces[3].Value && tableSpaces[2].Value % 3 != 0) || (tableSpaces[2].Value - 1 == tableSpaces[3].Value && tableSpaces[3].Value % 3 != 0))
             {
                 BetSpace  = new TableSpace(tableSpaces, 8);
                 BetAmount = betAmount;
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
         else
         {
             return(false);
         }
     }
 }
Beispiel #2
0
 /// <summary>
 /// Checks if the space rolled by the wheel was covered in this bet.
 /// </summary>
 /// <param name="rolledSpace">The space rolled by the wheel.</param>
 /// <returns>The total amount won in this bet.</returns>
 public decimal CheckWinnings(TableSpace rolledSpace)
 {
     if (BetSpace.Value == rolledSpace.Value)
     {
         return(BetAmount * BetSpace.PayoutMultiplier);
     }
     else if (BetSpace.ContainsSpaces != null)
     {
         foreach (TableSpace x in BetSpace.ContainsSpaces)
         {
             if (x.Value == rolledSpace.Value)
             {
                 return(BetAmount * BetSpace.PayoutMultiplier);
             }
         }
     }
     return(0); // You get nothing. You lose. Etc etc.
 }
Beispiel #3
0
        /// <summary>
        /// Creates a European (no 00 space) roulette table.
        /// </summary>
        public RouletteTable()
        {
            NormalSpaces = new TableSpace[37];
            for (int i = 0; i < 37; i++)
            {
                NormalSpaces[i] = new TableSpace(i, 35);
            }

            TableSpace[] TwoToOneASpaces = new TableSpace[12];
            for (int i = 1; i < 12; i++)
            {
                TwoToOneASpaces[i] = NormalSpaces[i * 3 - 2];
            }
            TwoToOneA = new TableSpace(TwoToOneASpaces, 2);

            TableSpace[] TwoToOneBSpaces = new TableSpace[12];
            for (int i = 2; i < 12; i++)
            {
                TwoToOneBSpaces[i] = NormalSpaces[i * 3 - 4];
            }
            TwoToOneB = new TableSpace(TwoToOneBSpaces, 2);

            TableSpace[] TwoToOneCSpaces = new TableSpace[12];
            for (int i = 3; i < 12; i++)
            {
                TwoToOneCSpaces[i] = NormalSpaces[i * 3 - 6];
            }
            TwoToOneC = new TableSpace(TwoToOneCSpaces, 2);

            TableSpace[] FirstDozenSpaces = new TableSpace[12];
            for (int i = 1; i < 13; i++)
            {
                FirstDozenSpaces[i - 1] = NormalSpaces[i];
            }
            FirstDozen = new TableSpace(FirstDozenSpaces, 2);

            TableSpace[] SecondDozenSpaces = new TableSpace[12];
            for (int i = 13; i < 25; i++)
            {
                SecondDozenSpaces[i - 13] = NormalSpaces[i];
            }
            SecondDozen = new TableSpace(SecondDozenSpaces, 2);

            TableSpace[] ThirdDozenSpaces = new TableSpace[12];
            for (int i = 25; i < 37; i++)
            {
                ThirdDozenSpaces[i - 25] = NormalSpaces[i];
            }
            ThirdDozen = new TableSpace(ThirdDozenSpaces, 2);

            TableSpace[] FirstHalfSpaces = new TableSpace[18];
            for (int i = 1; i < 19; i++)
            {
                FirstHalfSpaces[i - 1] = NormalSpaces[i];
            }
            OneThroughEighteen = new TableSpace(FirstHalfSpaces, 1);

            TableSpace[] SecondHalfSpaces = new TableSpace[18];
            for (int i = 19; i < 37; i++)
            {
                SecondHalfSpaces[i - 19] = NormalSpaces[i];
            }
            NineteenThroughThirtySix = new TableSpace(SecondHalfSpaces, 1);

            TableSpace[] EvenSpaces = new TableSpace[18];
            for (int i = 2; i < 37; i += 2)
            {
                EvenSpaces[i / 2 - 1] = NormalSpaces[i];
            }
            Even = new TableSpace(EvenSpaces, 1);

            TableSpace[] OddSpaces = new TableSpace[18];
            for (int i = 1; i < 37; i += 2)
            {
                OddSpaces[i / 2] = NormalSpaces[i];
            }
            Odd = new TableSpace(OddSpaces, 1);

            Red = new TableSpace(new TableSpace[]
            {
                NormalSpaces[1],
                NormalSpaces[3],
                NormalSpaces[5],
                NormalSpaces[7],
                NormalSpaces[9],
                NormalSpaces[12],
                NormalSpaces[14],
                NormalSpaces[16],
                NormalSpaces[18],
                NormalSpaces[19],
                NormalSpaces[21],
                NormalSpaces[23],
                NormalSpaces[25],
                NormalSpaces[27],
                NormalSpaces[30],
                NormalSpaces[32],
                NormalSpaces[34],
                NormalSpaces[36]
            }, 1);

            Black = new TableSpace(new TableSpace[]
            {
                NormalSpaces[2],
                NormalSpaces[4],
                NormalSpaces[6],
                NormalSpaces[8],
                NormalSpaces[10],
                NormalSpaces[11],
                NormalSpaces[13],
                NormalSpaces[15],
                NormalSpaces[17],
                NormalSpaces[20],
                NormalSpaces[22],
                NormalSpaces[24],
                NormalSpaces[26],
                NormalSpaces[28],
                NormalSpaces[29],
                NormalSpaces[31],
                NormalSpaces[33],
                NormalSpaces[35]
            }, 1);
        }
Beispiel #4
0
 /// <summary>
 /// Makes a bet on a single space.
 /// </summary>
 /// <param name="tableSpace">The space from your RouletteTable object that you wish to bet on.</param>
 /// <param name="betAmount">The amount to be bet.</param>
 public void MakeBet(TableSpace tableSpace, Decimal betAmount)
 {
     BetSpace  = tableSpace;
     BetAmount = betAmount;
 }
Beispiel #5
0
 public RouletteBet(TableSpace tableSpace, Decimal betAmount)
 {
     MakeBet(tableSpace, betAmount);
 }