#05Memory Card Game
Overview
Create a memory card game where cards are hidden, can be flipped to reveal matches, and track user clicks.
Requirements
- Display a grid of hidden cards.
- Shuffle the cards at the start of each new game.
- Clicking a card reveals its content.
- If two revealed cards match, keep them visible as matched.
- If two revealed cards do not match, hide them again after 1 second.
- Prevent clicking a third card while two non-matching cards are visible.
- Include a reset button that hides all cards and resets the click counter.
- Display the total number of clicks in the UI.
Notes
- Focus on managing the state of each card (hidden, revealed, matched).
- Think about how to track clicks and update the counter as the user interacts.
- Handle the timing of hiding non-matching cards carefully to avoid race conditions.
- Make sure the UI updates correctly when the game is reset.
Tests
- renders all cards hidden initially
- clicking a card shows it
- matching cards remain visible and matched
- non-matching cards hide after 1 second
- cannot click a third card while two non-matching cards are visible
- reset button hides all cards and resets clicks