Pixel Run

Pixel the robot cat runs through ten levels, and every obstacle is a Python function for you to write. Pass the tests and she jumps on. Fail three times and you are sent back a level.

The game

Level 1 of 10 Print Plains 0 0 Python: waiting

Calm mode stops the scrolling and the jumps. It switches on by itself if your device asks for less motion.

Loading the game.

How the game works

  1. Pixel runs by herself. You never have to time a jump. All of the skill is in the code.
  2. Every obstacle is a function to write. The task, a few worked examples and some starter code are on screen.
  3. Press Run tests. Your function is marked against every test. If they all pass, Pixel jumps the obstacle and runs on.
  4. Three obstacles clear a level, and ten levels clear the game. The first level asks you to join two pieces of text. The last asks you to write Dijkstra's algorithm.
  5. If the obstacle wins, you go back a level. Use up your three attempts, or give up, and Pixel is knocked back to the start of the previous level. You are shown a working solution first, so the setback teaches you something.
Replays are never the same

Every level has five challenges and a run uses three of them. When you are sent back, the level you replay deals the challenges you have not met yet, so remembering answers will not get you through.

The ten levels

LevelNameThe ideaRevise first
1Print PlainsText and arithmetic inside a functionVariables and data types, String manipulation
2Variable ValleyVariables, operators and roundingInput and operators, Variables and data types
3Selection Streamif, elif and elseSelection: if, elif and else
4Loop Lagoonfor and while loopsLoops: for and while, String manipulation
5List LandingLists, nested lists and searching a listLists, Arrays, records and files
6Function FortParameters, return values and validationFunctions and structure, Subprograms and parameters, Validation and testing
7Dictionary DunesDictionaries and recordsDictionaries, files and errors, Arrays, records and files
8Searching SummitSearching and sorting algorithmsSearching and sorting, Sorting algorithms in depth
9Recursion RuinsRecursionRecursion
10Complexity CastleStacks, queues, graphs and bitwise operationsStacks and queues, Trees and graphs, Dijkstra and A*, Binary and bitwise operations

The first three levels are the foundations every program is made of. Levels 4 to 8 are the Python that the GCSE specifications (OCR J277, AQA 8525 and Edexcel 1CP2) expect you to write, up to the searching and sorting algorithms by name. Levels 9 and 10 are A Level: recursion, stacks, queues, graphs, shortest paths and two's complement.

What a challenge looks like

Level 1, first obstacle: write a function that greets someone. You are given the function's name and a comment, and you fill in the rest.

def greet(name):
    # return "Hello, " then the name then "!"
    pass

Your function is then run on a set of calls, and each answer is compared with what the tests expect:

CallThe test expects
greet('Asha')'Hello, Asha!'
greet('Ben')'Hello, Ben!'
greet('')'Hello, !'

A test passes only when the answer matches exactly. True is not 1, a list is not a tuple, and "5" is not 5. Numbers are compared as numbers, so 2 and 2.0 are the same answer.

Some challenges have rules

The loop challenges ask you to use a loop, the recursion challenges ask the function to call itself, the sorting challenges will not accept sorted(), and the binary search counts how many items you look at. If your answers are right but you broke a rule, the game says so, and it counts as an attempt.

Attempts, hints and stars

Every challenge gives you three attempts. An attempt is a run where your code ran and a test failed, or a rule was broken. A syntax error, or forgetting to define the function, does not use an attempt, because nothing was marked.

StarsHow you earned them
3 starsPassed with no slips and no hints
2 starsPassed after one slip or one hint
1 starPassed after more than that

There are two hints on every challenge, and each one costs a star. Each level is worth up to nine stars, and the whole game is worth ninety.

Questions

Does my code leave my computer?

No. Python runs inside your browser tab, using Pyodide, which is Python compiled to WebAssembly. The tests arrive with the page and your code is marked on your own device. Nothing you write is sent anywhere, stored on a server or seen by anyone.

Do I need to install anything or make an account?

No. The first time you play, your browser downloads Python once (roughly ten megabytes, which it then keeps). That happens while Pixel is running towards the first obstacle.

What if Python will not load?

Some school networks block the download. If Python cannot be loaded, the game offers quiz mode: instead of writing the function you read a short piece of code and choose what it returns. The levels, the stars and the going-back-a-level rule all work the same way.

Is my progress saved?

On your own device only, in your browser's local storage, so you can pick up from the level you reached. Clearing your site data, or switching to a different browser, starts again.

Can I use it in a lesson?

Yes. It is free, there is nothing to sign up for, and every student plays on their own device. It works well as a starter, a plenary, or revision for a unit on programming. Because nothing is recorded centrally, a teacher cannot see who has played, and the best check is to ask students to show their level and star count.

Stuck on a level?

Each level lists the topics to read first. Reading the topic and then playing the level is the fastest way through, and the game links straight to it whenever a level beats you.