🧠 MEMORY MATCH

Sixteen cards, eight pairs — can you remember where they are?

← Back to Fun Time
Moves
0
Pairs
0 / 8
Stars
★★★
Best

⌨️ Controls

  • move the dashed cursor
  • Space or Enter turn a card over
  • Clicking or tapping a card works too
  • P pause  •  R new game
  • 🎮 Xbox controller? Just plug it in or pair it — the stick and D-pad are the arrow keys, A is SPACE, Menu pauses and View starts again

🎯 How to play

  • Sixteen cards lie face down, hiding eight pairs.
  • Turn two over. If they match they stay up; if not, they turn back — so remember them!
  • A move is a pair of cards, not a single one.
  • Find all eight pairs to win.

🏆 Scoring

  • Eight pairs cannot be found in fewer than 8 moves.
  • 12 moves or fewer = ★★★
  • 18 moves or fewer = ★★
  • More than that = ★ — everybody who finishes gets a star.

🧑‍💻 For young coders: build this game yourself

This game is split into small library files inside funtime/lib/, and every function has a comment saying exactly what goes in, what comes out, and the algorithm in plain English. Empty any function out, read its comment, and write it yourself.

File What it does Good functions to try re-writing
lib/memory-rules.js The rules: dealing, flipping, matching cardIndex, createDeck, isMatch, flipCard
lib/memory-draw.js Painting the cards and the eight symbols drawSymbol, drawCard, cardAtPixel
lib/memory-main.js The glue: clicks, keyboard, the loop doAction, canvasPosition, gameLoop

💡 The big idea: the sixteen cards are one flat list, and cardIndex(column, row) is the little sum that turns a grid into a list. Almost every board game you write needs it.

🛠️ Want to be walked through it? Build Memory Match Yourself takes you through the key functions one step at a time and tests each one you write. There is a Python version too.