Re: A83:Black Jack


[Prev][Next][Index][Thread]

Re: A83:Black Jack




In accordance with the prophecy, Olle Hedman uttered:


> I dont know what kind of deck you have, but in a normal deck of cards there is
> 52 cards..
> Anyway, I think this method (useing a virtual deck of cards) is the best way, if
> you want to do a _real_ simulation of Black Jack. A good BJ player keeps track
> of what cards is already played, and makes his choices from that.
> you can also have double, triple or more decks.
> and useing a deck automatically solves the double ace of spades thing.. (wich
> actually is possible, if you play BJ with a double (or more) deck)

> //Olle


52 + 2 jokers = 54.

Anyway, here's a good routine (in c-inspired pseudo code) to shuffle a deck:

deck[0] = 0;
for(i=1; i<52; i++)
{
  j = random number in the range 0 to i;
  deck[i] = deck[j]; deck[j] = i;
}


Linus

   - Linus Akesson ------------------------- http://linusworld.cjb.net -
   ::: :::. :.:: :. ::.. : :... ::.: ::. :::: :.:. :: :..: :.. :.: :....

         Veni, Vedi, Visa: I came. I saw. I did a little shopping.




Follow-Ups: References: