This is going to be a short section. Can you guess why? With the way the game works, there's really just one way to know when all of the matches have been made: when matchList is full. When matchList has 16 entries, all of the cards have been added to it, and all of the matches have been made. Of course, there are other ways you could approach this, such as creating a variable and incrementing each time a match was made and then checking when its value reached 8. But since matchList is already available, you might as well use it. Currently the only thing it's doing is making it so you can't click on already matched cards.
|