Slashdot Mirror


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. :)

5 of 28 comments (clear)

  1. Count cards? by rylin · · Score: 5, Funny

    Hey, I've been blacklisted at casinos for doing that, you insensitive clod!

  2. Good Timing by DrunkBastard · · Score: 5, Funny

    Nice, post about this when there's only 3 days left to submit your scripts...

  3. Warning to those who will enter by vslashg · · Score: 5, Informative
    From the contest rules:
    If both you and the dealer bust, the hand is a tie.
    I don't know what game that is, but it's not casino blackjack. If your plan is to quickly translate some blackjack code you've already written into PHP, you're going to have to compensate for their misunderstanding of the real rules.
  4. This is great! by Anonymous Coward · · Score: 5, Funny

    Looking around the web, and in my inbox, I see a total lack of anything like an online casino. Now that everyone has been told how to do php blackjack, maybe someone will get off the ball and fill in this much-needed online niche! Way to go!

  5. Re:not a good test by funbobby · · Score: 5, Insightful

    My first reaction to this is that they test them all against the same deals, so there's not much luck, but on further reflection there is luck, it's just more subtle than the luck you deal with in the casino.

    The luck in this game is whether or not the deals that everyone gets are the type of deals that your scripts handles well.

    So based on this, I think the winning strategy is the following:
    Write a script that will do very well against a certain kinds of draws, and poorly against others. This would be a poor strategy if you were playing for money, and got to keep the net, but that isn't the game. The game here is that if you do the best (or one of the best) you win, and everything else loses. So losing badly isn't any worse than doing well but not the best. So take advantage of this by writing an aggresive strategy that will lose on most draws, but is sure to win on some. This is much better than writing a conservative script that will do well on any draw, but will always lose to whichever aggressive script happened to hit on the particular draw that was used.

    When they run the contest, most of the entries will play a conservative strategy, and end up in a nice bell curve around a reasonable return. But the winner will be some off the wall script that does something crazy that happened to pay off against the draw they used.

    How crazy it will take to win will of course depend on the number of entries.

    You can be a sure winner if you get enough friends to enter with different aggresive strategies to cover all possible draws.

    I wish I wasn't too busy to do it myself :(

    - Funbobby