BLACKJACK
Code Explanation
var cardw = 75; Sets the width of each card
var cardh = 107; Sets the height of each card
var playerxp = 100; Sets the starting horizontal position
for the cards in the player's hand
var playeryp = 300; Sets the vertical position for the
cards in the player's hand
var housexp = 500; Sets the starting horizontal position
for the cards in the dealers hand
var houseyp = 100; Sets the vertical position for the
cards in the dealers hand
var housetotal; For the total value of the dealers
hand
var playertotal; For the total value of the players
hand
var pi = 0; Index for the next card in player's
hand
var hi = 0; Index for the next card in the
dealers hand
var deck = []; Holds all the cards
var playerhand = []; Holds the cards for the player
var househand = []; Holds the cards for the dealer
var back = new Image(); Used for the card back
function init() { Function called by onLoad in body to
performs initialization tasks
ctx = document.getElementById('canvas').
getContext('2d');
Sets the variable used for all drawing
ctx.font="italic 20pt Georgia"; Sets the font