Memory Game

MediumMemory GameReactGame30 mins

by Pratik Rai

Read the full write-up

Build a memory game: sixteen face-down cards, eight matching pairs. Flip two — if they match they stay up, if not they flip back after a short pause.

The shuffled deck is given to you.

Requirements

  1. All cards start face down. Clicking one turns it face up.

  2. When two cards are face up, compare them after roughly 700ms — matching cards stay up, others flip back.

  3. While two cards are being compared, clicking a third does nothing.

  4. Clicking an already-matched card, or the card that is already face up, does nothing.

  5. Show the move count and how many pairs are matched, and say something when all eight are found.

  6. New game reshuffles and clears everything.

Notes

  • A face-down card should render no symbol at all — hiding it with colour still leaves it in the DOM for anyone who looks.

  • Card flip animations are out of scope.

Hints

Loading editor…