diff --git a/index.html b/index.html index 9386faaf4..50e7e733d 100644 --- a/index.html +++ b/index.html @@ -1,23 +1,29 @@ - - - - - Superhero Memory Game - - - -
-

Superhero Memory Game

-
-
-

Score

-

Pairs clicked: 0

-

Pairs guessed: 0

-
-
- - - + + + + + Superhero Memory Game + + + + + +
+

Superhero Memory Game

+
+
+

Score

+

Pairs clicked: 0

+

Pairs guessed: 0

+
+
+ + + + + + + \ No newline at end of file diff --git a/src/memory.js b/src/memory.js index f6644827e..210c419e6 100644 --- a/src/memory.js +++ b/src/memory.js @@ -2,17 +2,28 @@ class MemoryGame { constructor(cards) { this.cards = cards; // add the rest of the class properties here + this.pickedCards = [] + this.pairsClicked = 0 + this.pairsGuessed = 0 } shuffleCards() { // ... write your code here + } checkIfPair(card1, card2) { // ... write your code here + this.pairsClicked++ + if (card1 === card2) { + this.pairsGuessed++ + return true + } + return false } checkIfFinished() { // ... write your code here + return this.pairsGuessed === this.cards.length / 2 } }