# VB functions for determining red/black numbers on roulette wheel

Here are two simple functions for calculating if a number falls on red or black on a roulette wheel, for the perfectionists that don’t want to use odd/even.

```'isRed calculates if a number falls red on a roulette wheel
Public Function isRed(ByRef n As Long) As Boolean
Select Case n
Case 1, 3, 5, 7, 9, 12, 14, 16, 18, 19, 21, 23, 25, 27, 30, 32, 34, 36
isRed = True
Case Else
isRed = False
End Select
End Function

'isBlack calculates if a number falls black on a roulette wheel
Public Function isBlack(ByRef n As Long) As Boolean
Select Case n
Case 2, 4, 6, 8, 10, 11, 13, 15, 17, 20, 22, 24, 26, 28, 29, 31, 33, 35
isBlack = True
Case Else
isBlack = False
End Select
End Function
```

# 8 Suits – eight suited playing cards

8 Suits, as you guessed is a deck of playing cards with an additional 4 suits, the clover, tear, crescent and star for a total of 104 cards plus a number of jokers.

Priced at \$12 USD per deck plus \$5 per postage (\$13 per postage internationally), it is a little steeper than The Fat Pack, at roughly \$16 USD including international postage. Unfortunately, I discovered the former after ordering the 8 Suits.

The following show how 8 suits affect the probability of standard poker hands;

```Poker Hand         No of Combinations        Probability
--------------------------------------------------------
Royal Flush                         8       0.0000000870
Straight Flush                     72       0.0000007829
Five of a Kind                    728       0.0000079163
Flush                          10,216       0.0001110887
Four of a kind                 87,360       0.0009499522
Full House                    244,608       0.0026598662
Straight                      327,600       0.0035623208
Three of a Kind             3,075,072       0.0334383181
Two Pair                    5,381,376       0.0585170567
Pair                       41,000,960       0.4458442418
No Pair                    41,834,520       0.4549083692

Total                      91,962,520       1.000000000```

To view the probabilities for any other numbers of suits.

# Poker hands probability calculator for any number of suits and ranks (denominations)

After purchasing a 5 suited deck of cards and an 8 suited deck of cards, I decided to work out how the numbers of suits affect the probabilities of each poker hand.

Further, the following can calculate combinations and probabilities for any number of suits and any number of ranks (number of denominations).

You will notice;

• at 5 suits a Flush overtakes a Full House,
• at 6 suits a Flush overtakes a Four of a Kind, and
• at 13 suits a Flush overtakes a Five of a Kind.

If you don’t believe the numbers, you are more than welcome to add them up and email me.

(thanks to CodeCogs for there LaTeX Engine)

# PHP Factorial and Combination functions

A quick post on two functions for PHP that provide factorial and combination support.

```function factorial(\$n) {
if (\$n <= 1) {
return 1;
} else {
return factorial(\$n - 1) * \$n;
}
}

function combinations(\$n, \$k) {
//note this defualts to 0 if \$n < \$k
if (\$n < \$k) {
return 0;
} else {
return factorial(\$n)/(factorial(\$k)*factorial((\$n - \$k)));
}
}
```

# 5 Dimension – a 5 suit playing cards

I recently purchased a 5 Dimension (5D) deck of playing cards from Canada for \$5 (plus \$5 shipping to Australia). Unlike a normal deck, the 5D deck has an extra suit, the star, plus a numeric 1 card (as opposed to an ace), a princess card and jokers, totalling 80 playing cards.

The cards are standard bridge size 2.25″ x 3.5″ (the thinner width making it easier to hold more cards), with a card width of 0.3 mm. The card material is of quite good quality, with no ruined corners yet.

So how does an extra suite and more denominations affect the probabilities of standard 5 card poker hands? With reference to Durango Bill’s Poker Probabilities, the probabilities in a 5 suit 13 denomination deck are as follows:

```Poker Hand        Number of Combinations     Probability
--------------------------------------------------------
Royal Flush                         5        .0000006053
Five of a kind                     13        .0000015739
Straight Flush                     45        .0000054480
Four of a kind                  3,900        .0004721614
Flush                           6,385        .0007730129
Full House                     15,600        .0018886455
Straight                       31,200        .0037772909

Total                       8,259,888       1.0000000000```

The biggest difference is a Full House is easier to be dealt then a Flush.

Now, how does adding a One and Princess denomination affect the probabilities.

```Poker Hand        Number of Combinations     Probability
--------------------------------------------------------
Royal Flush                         5        .0000002897
Five of a kind                     15        .0000008691
Straight Flush                     55        .0000031867
Four of a kind                  5,250        .0003041822
Flush                          14,955        .0008664849
Full House                     21,000        .0012167290
Straight                       37,440        .0021692540

Total                      17,259,390       1.0000000000```

A Full House remains a higher probability, but with a high probability of obtaining a Flush.

To see how the above combinations where calculated refer to;
Poker hands probability calculator for any number of suits and ranks (denominations)

Update: October 2009

After over a year of use and into the second deck, I thought I would retract my statement stating ‘The card material is of quite good quality’. These cards damage very easily, the photos speak for themselves.

Update: June 2010
Want more suits? Check out 8 Suits here.