次の方法で共有


Blackjack

Today's game example is inspired by Ocean's 13 (available on HD DVD this fall).  Blackjack is one of my favorite casino games, but I was too busy at NAB this year to make it to the tables.  So, here it is for you in HDi (with some graphics assistance from John Green - Thanks, John!).  

Writing the script for blackjack is pretty simple.  So, the trick here is take advantage of what you can do via markup in HDi (see my last post).  If you open this project up (a zip file is attached at the end of this blog) you will see that the only time the script modifies the markup is to change the value of the bet and the bank (setting state), to update the value of the hand total (again, setting state), and to set the background frame of the card container (this is the only time style is ever changed via script).  Buttons focusing or disabling, divs hiding, showing, or moving is all done via markup cues triggered by XPath variables. 

Suggested upgrades (read: exercise for the reader) to this app include:

  • Allow user to set up game
    • Decks in shoe
    • Starting bank
    • Minimum bet and bet increment
    • Username
  • Add a mode to accept insurance when the dealer is showing an ace
  • Add option to save bank at end of game to persistent storage
  • Add option to upload score and download high scores from network
  • Create a "hint" option that tells the user the recommended move

blackjack.zip

Comments

  • Anonymous
    May 16, 2008
    The comment has been removed