The Essential Guide to HTML5
BLACKJACK (punctuation) for referencing an attribute of an MCard object when the object is an element of an array is playerhand[ ...
CHAPTER 10 Note that more_to_house is a function that generates a true or false value. This value will be based on a calculation ...
BLACKJACK sum is less than 17. If it is, it returns true, which tells the calling function to request a new card. If the value e ...
CHAPTER 10 shuffling/) explaining the Fisher-Yates algorithm. The strategy of this algorithm is to make a random determination f ...
BLACKJACK { keyCode = window.event.keyCode; window.event.preventDefault(); } else { keyCode = event.keyCode; event.preventDefaul ...
CHAPTER 10 Using header and footer element types HTML5 added some new built-in element types including header and footer. The ra ...
BLACKJACK Function Invoked / Called by Calls deal getkey Two calls to dealfromdeck and one call to more_to_house more_to_house d ...
CHAPTER 10 Code Explanation body { Specifies the style for the body element background-color:white; Sets the background color co ...
BLACKJACK Code Explanation var cardw = 75; Sets the width of each card var cardh = 107; Sets the height of each card var playerx ...
CHAPTER 10 Code Explanation ctx.fillStyle = "blue"; Sets the color builddeck(); Invokes the function to build the deck of cards ...
BLACKJACK Code Explanation event.preventDefault(); Stops other key responses } Close clause switch(keyCode) { Header for the swi ...
CHAPTER 10 Code Explanation ctx.drawImage(playerhand[pi].picture, playerxp,playeryp,cardw,cardh); Draw on the canvas playerxp = ...
BLACKJACK Code Explanation ctx.drawImage(playerhand[pi].picture, playerxp,playeryp,cardw,cardh); Draws on the canvas playerxp = ...
CHAPTER 10 Code Explanation if (ac>0) { if statement to determine if there were any aces if ((sumup+10)<=21) { If so, asks ...
BLACKJACK 339 Code Explanation } Close the while loop if (ch>=51) { Asks if there were no undealt cards ctx.fillText("NO MORE ...
CHAPTER 10 Code Explanation for (n=0;n<13;n++) { Iterates over the cards in a suit picname=suitnames[si]+"-"+nums[n]+ "-75.p ...
BLACKJACK Code Explanation var i; For iteration var sumup = 0; Initializes the sum for (i=0;i<pi;i++) { Loops over the cards ...
CHAPTER 10 Code Explanation housexp = housexp+20; Adjusts the horizontal pointer hi++; Increases the index for the dealers hand ...
BLACKJACK Code Explanation if (playertotal>housetotal) { Performs a more specific comparison ctx.fillText("You won. ",30,100) ...
CHAPTER 10 Code Explanation housexp= 500; Resets the horizontal position for the dealers hand dealstart(); Calls the function t ...
«
10
11
12
13
14
15
16
17
18
19
»
Free download pdf