HTML and CSS Reference
In-Depth Information
Code
Explanation
housexp = housexp+20;
Adjusts the horizontal pointer
hi++;
Increases the index for the dealers
hand
}
Closes the while loop
showhouse();
Reveals the dealers hand
playertotal = add_up_player();
Determines the players total
if (playertotal>21){
Asks if the player was over
if (housetotal>21) {
Asks if the house was over
ctx.fillText("You and house both
went over.",30,100);
Displays a message
}
Closes the inner if statement
else {
Begins else clause
ctx.fillText("You went over and lost."
,30,100);
Displays a message
}
Closes the else clause
}
Closes the outer clause (player is
over)
else
else the player is not over
if (housetotal>21) {
Asks if the dealer was over
ctx.fillText("You won. House went
over.",30,100);
Displays a message
}
Close the clause
else
else
if (playertotal>=housetotal) {
Compares the two amounts
Search WWH ::




Custom Search