Download task_002/instruction.md from Lego-X/UXInteract: direct link, hf CLI and curl.
- Browser
- Download file 1.57 kB
-
https://huggingface.co/datasets/Lego-X/UXInteract/resolve/main/task_002/instruction.md
- Command line
-
hf download hf://datasets/Lego-X/UXInteract/task_002/instruction.md
-
curl -L -o instruction.md https://huggingface.co/datasets/Lego-X/UXInteract/resolve/main/task_002/instruction.md
Memory matching game
Build a browser game with a 4×4 grid of cards containing eight pairs. Let the player reveal cards with a flip animation and match pairs. Deliver an offline index.html at the project root.
Interaction and state interface
Expose window.gameTest with reset(deck?), flip(index), advance(milliseconds), and state(). If supplied, use the 16-item deck in its given order. Return {cards:[{value, faceUp, matched}, ...], moves, matchedPairs}. The API operates on the same cards and game logic as clicks. Advancing virtual time only advances the mismatch wait and updates the display.
The first eligible flip reveals a card. A second eligible flip counts one move. Matching cards remain face up; mismatches are visible for 300–2000 ms, then both turn face down. No third flip is allowed while a mismatch is pending, and face-up or matched cards cannot be flipped again.
Acceptance Checklist
- The offline page renders the cards; flipping reveals the selected value on the same board used by the state interface.
- A supplied deck keeps its order. The first flip does not count a move; the second counts exactly one. Duplicate flips and flips during the mismatch wait leave state unchanged.
- A mismatch turns back within the allowed delay without counting another move. All eight pairs can be matched; matched cards stay visible and the counters reflect completed turns and matches.
- Reset hides and unmatches all cards, clears both counters and cancels any pending mismatch, even if a new pair is played immediately afterward.