Play Blackjack with PHP
Zack Coburn writes "The latest Codewalkers PHP Coding Contest invites PHP programmers to compete by creating a PHP script that interfaces with a special PHP library to play the game of Blackjack. Judging will happen as follows: 'A number of random decks will be generated, for each random rules will be used. Each script will then play all these decks, so each script will play under exactly the same conditions. In the end, the sum of all the money gained will determine the winner. In case of a tie, the running time will be the tie-breaker.' Some of the sixteen prizes include Cerberus Encoder, PHPEd, Macromedia Studio MX, SourceGuardian Pro, and Zend Studio." Here's a hint: count cards. :)
Well, almost 'always', anyway. If your in third base, holding a 12 against a dealers 3, and the last 7 cards have been faces, then a hit would be a good thing, even though it is against basic strategy.
The other exception is if you are keeping a side count of faces, you can use that information to choose to take insurance. Playing basic strategy, insurance (or even money on a BJ) is always a bad idea.
On your second to last point, I wounder how well a program : "sitdown(); bed(0); leave(); " would do ....
I don't know about the math behind it - but I have read and heard that shuffling is not truely random.