Problem Brief
Build a 2-by-4 Memory Match card game tracking flips, increments per pair attempt, matching locks, and Restart reset.
Requirements
- Render 8 card buttons `[data-card-idx="0..7"]` with paired values (`A, A, B, B, C, C, D, D`).
- Increment `[data-testid="moves"]` every time a 2nd card completes a pair attempt.
- Matching pair stays `.is-matched`; mismatched pair flips closed after brief delay.
Progressive Hints (1)
- Keep `firstIndex`, `moves`, and `matched` Set; guard against clicking already matched cards or double-clicking the same index.
Reference Solution
Stuck? Load the verified reference code into your editor.
Automated Test Suite
2 Test Cases Ready- Matches identical pair and increments move countFlipping 0 and 1 marks both .is-matched and Moves: 1
- Unflips mismatched pair and supports RestartFlipping C and D resets them after delay and Restart zeroes moves
Live Sandboxed Previewiframe sandbox