Games · Project

Build Pairs in Python

A memory game: sixteen face-down cards hide eight pairs, and a turn flips two.

You write: The whole program, from a description: which cards are up, what the next click does, the turn count and the end.

Loading the game…

What to build

Sixteen cards lie face down in four rows of four. They hide eight pairs of letters. A turn is two clicks: each turns one card face up. If the two match, they stay up for the rest of the game. If they do not, they stay up until the next click, and that click, wherever it lands, only turns them back down. Count the turns, and say when every pair has been found.

The starter gives you the sixteen cards in the order they lie, row by row.

Not sure where to start?

This game is part of “Build a Game”, a lesson of Build with Python. The lesson builds up to it, and the course before it starts from zero. Both are free.

Read the lessonSee the course

More games

  • Hit the Target: A first click game: every click lands a dot, green inside the target and red outside.
  • Tic-Tac-Toe: A two-player Tic-Tac-Toe you can play in the page: turns, a win in any line, and a draw.
  • Lights: A puzzle on a five-by-five grid: a click switches a light and its neighbours, and the goal is to turn every light off.
  • Four in a Row: A game for two: counters drop down the columns of a board, and four in a line wins.