Play Memory Match
A colorful memory card game built with plain JavaScript and CSS. Flip cards to find matching pairs of code symbols. Play solo for a best score, or duel a friend on one device.
This is a real, playable game, not a screenshot. Flip cards two at a time and remember where each symbol sits to match all eight pairs. It is built with no library and no canvas, just a shuffled deck and a little state, which makes it a clean example of comparing values and tracking turns. After you play, the sections below show how it works.
How to play
The board has sixteen cards face down, hiding eight matching pairs of code symbols. Tap a card to flip it, then tap a second. If the two symbols match, the pair stays face up and is yours. If they do not, both flip back, so it pays to remember where each symbol was. Clear all eight pairs to finish. In Solo you are trying to clear the board in as few moves as possible. In the 2 player duel you take turns, a match lets you go again, and a miss passes the turn, with the most pairs winning.
How this game is built
Memory Match is a clean lesson in state, events, and a touch of CSS.
Building and shuffling the deck
Each symbol is added twice and the deck is shuffled, then the cards are created from that list. The shuffled deck is the single source of truth the rest of the game reads, the idea at the heart of game state management.
Showing a card without images
Each card is a single button whose colour and symbol are set directly when it is revealed and cleared when it flips back, a simple separation of data and presentation in the spirit of rendering.
Matching and turns
When two cards are face up the code compares their symbols and either locks the pair or flips them back after a pause. In the duel a match keeps the turn and a miss passes it, all plain state transitions.
Reacting to a tap
Every move starts with a tap, ignored while the board is briefly locked so a mismatch can be seen, the careful input handling described in handling game input.
Why matching mirrors real code
Comparing two things and acting on whether they are equal is one of the most common operations in all of programming. Looking something up, checking a key, deciding if two values match, it happens constantly under the surface of every app. This game is that idea slowed down and made visible, and the way it tracks flipped, matched, and locked states is the same kind of bookkeeping behind responsive interfaces and the patterns in event driven UI. Remember the board, and you are doing by hand what a lookup table does in code.
Frequently asked questions
How do I play Memory Match?
Flip two cards by tapping them. If the symbols match, the pair stays; if not, they flip back. Remember where symbols are and clear all eight pairs.
What is the 2 player duel?
Two players take turns on the same board. Finding a match scores a pair and lets you go again, while a miss passes the turn to the other player. The most pairs at the end wins.
What do the symbols mean?
They are common code symbols like braces, arrows, and operators, used here just as pictures to match. You do not need to know what they do to play.
How does this relate to real programming?
It models comparing values for equality and tracking simple state, the flipped, matched, and locked flags, which is the same bookkeeping behind lookups and responsive interfaces.
Want the engineering behind responsive, stateful UIs?
See how event driven interfaces track and react to state.
Read: Event Driven UI →