HTML and CSS Reference
In-Depth Information
The actual practices of dealers at casinos may be different from this. This is an opportunity for research!
The player also can bluff the house by going over and not revealing it. This may lead the house to request
another card and go over also. The game is decided if and only if the player clicks the h key to hold, and
thus stop drawing cards.
You may want to provide feedback to the player when a key that is not d, h, or n is pressed, as shown in
Figure 10-8.
Figure 10-8. Feedback when a wrong key is pressed
Critical requirements
The blackjack game will make use of many of the HTML5, CSS, and JavaScript features described for the
previous games.
The first issue I had when starting the implementation was to find a source of images for the card faces. I
knew I could make my own drawings, but I preferred something more polished than I could produce.
The next challenge was how to design what a card was in programming terms so that I could implement
dealing cards, showing the back or the face. I also wanted to investigate how to shuffle the deck.
Another challenge was implementing the way a player would play the game. I chose to use key presses: d
to deal, h to hold, and n to begin a new game. There are, of course, alternatives, for example, displaying
buttons with words or graphics or using other keys, such as the arrow keys. The absence of a clear,
intuitive interface made it necessary to display the directions on the screen.
The last challenges are the general ones of maintaining the state of the game, the visible display, and
internal information; generating the computer moves, and following the rules.
 
Search WWH ::




Custom Search