Pinball Lab teaching notes

For middle and high school computer science teachers. Students write the rules of a pinball machine in Blocks or Python: when a switch closes, pulse a coil, add points, light a lamp. The machine starts dead, and the student's rules make it a game.

Using this with a class? Make a free class and add your students yourself: each gets a username and password, with no email or Google account needed. Or give them one join code. Using Google Classroom? Post the link there; with a free class, the link also puts each student in your class, so you see their work. mytekDev is also available from the Google Workspace Marketplace, so your school's Google admin can install it for everyone.A first lesson: Open it on the projector at Level 1, press play and shoot the ball: it hits the pop bumpers and nothing happens, no kick, no light, no points. Ask why. Then build one rule in Blocks with the class, when Bumper 1 is hit, pulse its coil for 30 ms, add 100 points, and play again. Ask what the machine knows about the ball, and what it does not.

Set up a free class Share to Google Classroom
Put this on your class site

Students can use Pinball Lab right on your page, with no account. What they make stays on that page; to keep their work, they make a free account.

Google Sites: Insert, then Embed, then By URL, and paste this address.

https://mytekdev.com/try/pinballlab?embed=1

Canvas, a blog, or any page that takes HTML: paste this code where you edit the page as HTML.

<iframe src="https://mytekdev.com/try/pinballlab?embed=1" width="100%" height="640" style="border:0" allow="fullscreen" title="Pinball Lab demo from mytekDev"></iframe>

About these notes

Pinball Lab is one machine: a playfield with three pop bumpers, two slingshots, three top lanes, a bank of three drop targets, a saucer, a spinner, two flippers and a plunger, in a dim game room. Every bumper, lane, target, the saucer and the spinner is a switch; every bumper, slingshot, the saucer and the targets' reset is a coil; the lights under the playfield are lamps. The student writes the rules: when a switch closes, what to pulse, what to light, what to score.

With no rules the table is dead. The flippers and the plunger work, because they are wired to the buttons as on a real machine, but nothing else does. That dead table is the first lesson: the game is the program.

A first period

Level 1 on a projector, then everyone on their own machine.

  1. Play it dead (5 minutes) Open Level 1, press play, hold Space and let go. The ball hits the bumpers and nothing happens. Ask what is missing.
  2. One rule (10 minutes) In Blocks: when Bumper 1 is hit, pulse its coil for 30 ms, add 100 points. Play again. The red bumper kicks and scores; the other two are still dead. Ask why.
  3. Every bumper (10 minutes) Change Bumper 1 to any bumper. Its coil now means the coil of whichever bumper was hit: one rule, three bumpers.
  4. Test it by hand (10 minutes) Table, Test bench. Click a part and close its switch: the card says which rules ran, which coils fired and the points. Ask students to predict before each click.
  5. Exit question (5 minutes) What does the machine know about the ball? Only which switches closed.

The nine levels

Each level passes on what the machine logged during a game, never on the program's text. Levels 10 to 13 come in a later version.

LevelThe goalWhat it shows
1. Wake it upA bumper's rule pulses its coil and scores.Events: a switch closes, a rule runs.
2. Light the lanesLight each top lane; all three lit pays 1,000 or more and puts them out.Lists and all. Tip: a flipper rule can move the lit lamps over (lane change).
3. Drop targetsWhen all three are down, award 2,500 or more and reset the bank.A bank as a list; the reset coil undoes its state.
4. Coils have limitsThree slingshot kicks in a game and no coil burned out.A coil left on burns out in about 7 seconds here; pulse it instead.
5. Hurry upA lane lights Hurry for 10 seconds; bumpers are worth 1,000 while it is lit.Timers: a rule never waits. (A real hurry-up counts its value down.)
6. Lock and multiballLock a ball in the saucer while Lock is lit, then start multiball.State that the rules keep and must reset.
7. Fair playA ball saved by a ball save, and a bonus paid at the end of a ball.Ball save, the bonus, nudging and tilt.
8. ModesA mode's own rule scores, and the mode ends.A mode takes over a switch while it runs.
9. Under the glassWith the scan at 25 ms the spinner's turns are missed; read every 2 ms or faster and count ten or more.The switch matrix, missed closures and ghosts.

What students get wrong, and where the app answers it

From the research behind the app (spec 278, sources A3).

What students thinkWhat happensWhere they see it
The machine knows where the ball is.It knows only which switches closed, and when.Level 9 and Under the glass.
A bumper is just bouncy.A passive rubber never sends the ball off faster than it came; a pop bumper's coil adds energy from the wall socket.Level 1: the dead bumper against the pulsed one.
A heavier ball rolls down faster.A rolling ball speeds up at 5/7 of g times the sine of the slope, whatever its mass.Help, The ball.
Turning a coil on is the same as pulsing it.A coil left on heats and burns out; real coils are pulsed for about 10 to 40 milliseconds.Level 4 and the heat bars.
A rule can wait for something.A rule runs to its end at once; anything later is a timer.Level 5.
Two rules for one event both just run.In a mode, the mode's rule takes the switch and the usual rule waits.Level 8.

What the app simplifies, on purpose

The rule sheet students hand in

File, The rule sheet: a shot map of the table naming every switch, each rule in plain words, the scoring from the last game (how many times each switch closed and the points it was worth a hit), the coils and how often each fired, and the program. It prints on its own page.

Setting it up for a class

Nothing to install. Students need a keyboard for the flippers (Shift keys, or Z and /) and Space for the plunger; a touchscreen shows big buttons instead. Saving needs an account on the platform; trying it does not.

Help, Same on every computer? runs a fixed game and shows a code. Every computer that shows the same code plays a shared table exactly the same way.

Standards

More help

Is something on this page wrong or not clear? Write to us.

Page last reviewed November 2026.
Google, Google Classroom and Chromebook are trademarks of Google LLC.