FAK LAB Memory Game
🧠

Memory Card Game

Flip cards to find matching pairs — train your memory!

0
Moves
0
Pairs
0s
Time
🎉

You Won!

How to Use the Memory Card Game

  1. Select Difficulty: Choose from three grid sizes — 4×4 (Easy, 8 pairs), 6×4 (Medium, 12 pairs), or 6×6 (Hard, 18 pairs) using the dropdown menu.
  2. Start Playing: Click "New Game" to shuffle and deal the cards face-down. The timer begins on your first move.
  3. Flip Cards: Click any face-down card to reveal its emoji. Then click a second card to check for a match. If both emojis are identical, the pair stays revealed.
  4. Track Progress: Monitor your performance with the live Moves counter, Pairs matched, and elapsed Time displayed at the top.
  5. Win & Replay: Match all pairs to win. Your best score is saved locally. Click "Play Again" to challenge yourself to beat your personal record.

Technical Overview & Use Cases

This memory game implements a classic card-matching algorithm using CSS 3D transforms for realistic card-flip animations with hardware-accelerated perspective rendering. The game engine uses Fisher-Yates shuffle for cryptographically fair card distribution, ensuring each game layout is genuinely random. State management tracks flipped cards, matched pairs, and timing through a lightweight reactive architecture — no external framework dependencies. The 3D card animation uses backface-visibility and rotateY transforms computed by the GPU for smooth 60fps transitions even on mobile devices.

Real-world use cases:

Privacy & Security Guarantee

This tool is part of the FAK LAB ecosystem, founded by Faizan Ahmad Khan Khichi. The memory game runs 100% client-side with zero network requests during gameplay. Your best scores are stored exclusively in your browser's localStorage — no personal data, gameplay statistics, or behavioral patterns are ever transmitted to external servers. The game requires no login, no account creation, and collects no analytics.

Frequently Asked Questions

How is the card shuffling implemented?

The game uses the Fisher-Yates (Knuth) shuffle algorithm with Math.random() as the entropy source. Each emoji is duplicated to create pairs, then the array is shuffled in-place by swapping elements from the end to a random earlier position. This guarantees uniform distribution — every possible card arrangement has equal probability of appearing.

Are my high scores saved between sessions?

Yes. Your best score (lowest move count) is persisted in your browser's localStorage under the key "memory_best_moves". This data survives browser restarts and tab closures but is device-specific. Clearing your browser data will reset your records. No scores are uploaded or synced across devices.

Does the game work on mobile devices?

Absolutely. The responsive grid layout adapts to any screen size using CSS Grid with auto-fill columns. Touch events are handled natively through click listeners. The 3D card-flip animations use GPU-accelerated CSS transforms (transform: rotateY) for smooth performance even on lower-powered mobile processors. The aspect-ratio property ensures cards remain square regardless of viewport dimensions.