HTML and CSS Reference
In-Depth Information
cx = cx+cardwidth+ margin;
Increment to allow for
card width plus margin
acard.draw();
Draw the card on the
canvas
bcard.draw();
Draw the card on the
canvas
Close the for loop
}
Shuffle();
Shuffle the cards
}
Close the function
function shuffle() {
Header for shuffle
function
var i;
Variable to hold a
reference to a card
var k;
Variable to hold a
reference to a card
var holder;
Variable needed to do
the swap
var dl = deck.length
Variable to hold the
number of cards in the
deck
var nt;
Index for the number
of swaps
for (nt=0;nt<3*dl;nt++) {
For loop
i = Math.floor(Math.random()*dl);
Get a random card
k = Mathfloor(Math.random()*dl);
Get a random card
Store the info for i
holder = deck[i].info;
deck[i].info = deck[k].info;
Put in i info for k
Put into k what was in
k
deck[k].info = holder;
Search WWH ::




Custom Search