Games

Build games in Python, in your browser

Small games to program yourself: write the Python, run it, play what you made, and let the checks play it too. Nothing to install.

  1. Guided

    Hit the Target

    A first click game: every click lands a dot, green inside the target and red outside.

    You write: A function that says whether a point is inside a rectangle, and the function that answers each click.

    From the lesson “Functions”

  2. Guided

    Tic-Tac-Toe

    A two-player Tic-Tac-Toe you can play in the page: turns, a win in any line, and a draw.

    You write: The click handler that makes a move and looks for a winner, and the test for a full board. The drawing and the rules are given.

    From the lesson “Build a Game”

  3. Project

    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.

    You write: The whole program, from a description: the grid, the switching rule, the picture, the move count and the end.

    From the lesson “Build a Game”

  4. Project

    Four in a Row

    A game for two: counters drop down the columns of a board, and four in a line wins.

    You write: The whole program, from a description: the falling counters, the full columns, the turns and the search for four in a line.

    From the lesson “Build a Game”

  5. Project

    Pairs

    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.

    From the lesson “Build a Game”

New to Python?

These games come from Build with Python, a free course that starts from zero and reaches them lesson by lesson. A guided game gives you starter code; a project gives you a description and leaves the plan to you.

Start the course