Re: PHP P O K E R...... and JAVA (convert)

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

 



On 6/27/07, Stephen <stephen-d@xxxxxxxxxx> wrote:
Tijnema <tijnema@xxxxxxxxx> wrote:
Well, I find this a very interesting thing ;)

I have played quite a lot poker, and I still play it sometimes, and
this doesn't seems too hard for me :)

My approach would be this:
1) Deal cards, rand(1,13) for the numbers(1-> Ace, 11->Jack,
12->Queen, 13->King), and rand (1,4) for color(1-> spades, 2-> clubs,
3-> diamonds, 4->hearts)
2) Betting, with some buttons and AJAX to update pot etc.
3) Turn
4) Step 2
5) River
6) Step 2
7) Looping through all players and check what their highest
combination is, take the 2 best combinations, and see if they are
equal.If not, the highest wins of course, but if they are equal, check
if number 3 has also same combination, and if so, check number 4, ...
Now you have some players with same combination, and you need to sort
the guys by highest cards in combination. If one has higher cards than
all others, he won. If not, get only those guys that have the same
highest cards in the combination, and check those guys for their
kicker (only for Pair, Two pair, Three of a Kind, Four of a Kind). If
their kicker is equal, or there combination isn't the one I noted,
it's a split pot :)

Not too hard to program right?

Tijnema

You need to add logic to ensure that the same card is not dealt twice!
An initial routine to shuffle the deck is the approach that I would take.

Stephen

Yes, I fixed that in a second reply ;)

Tijnema

--
Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux