THE MEMORY (AKA CONCENTRATION) GAME
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
holder = deck[i].info; Store the info for i^
deck[i].info = deck[k].info; Put in i info for k
deck[k].info = holder; Put into k what was in
k