What is the game of Concentration?

Concentration is a memory game where you flip over cards, trying to get two cards that match.

For more information on this type of game, read the Wikipedia article here.

The game is usually played on a 13 x 4 grid, as shown in the image below.

Click on the image to move to the game. The game will open in a new tab

Preliminary Software Design:

Constants: none

Cards:

There will be 13 different types of cards, with 4 of each card spread across the board.

The different types are as follows: diamond, heart, club, spade, square, circle, triangle, key-hole, cat paw, penguin, snowman, pokeball, and a leaf.

In the current implementation, there are not specific card objects, but they are all contained as part of arrays
The Deck object contains 3 variables, all being arrays.
Deck{deckUsed, shuffledDeck, shownDeck}
deckUsed is used for initializing the deck, and is an array of 13 elements.
shuffledDeck contains all card numbers (4 of each type of card) and contains 52 elements
shownDeck is used for the draw function to determine whether the card should be shown or if it should only show the back.

Functions/Methods

The following functions use the Deck object

initDeck(): initializes the Deck.deckUsed array to all be zero.
initShown(): initializes the Deck.shownDeck array so every element is false.
shuffleDeck(): randomly assignes a number between 0 and 12 to each place in Deck.shuffledDeck. Increments the corresponding place in Deck.deckUsed and rolls again if Deck.deckUsed[i] = 4.
drawTable(): writes the inner HTML of the table object, uses the drawCard(x,y) function.
drawCard(x,y): takes the value of Deck.shownDeck as x and Deck.shuffledDeck as y. Returns HTML code to draw the appropriate image for the card.
toggleShown(x): takes the index of the card to be flipped. Runs drawTable() to refresh the image.
startGame(): runs (in order) initDeck(), initShown(), shuffleDeck(), drawTable() to generate the game.