๐ŸŽต SIMON SAYS in Python

The same memory game โ€” but every line of it is Python, running in your browser

โ† Back to Fun Time
๐Ÿ Starting Pythonโ€ฆ
Round
1
Score
0
Length
1
Best round
0

โŒจ๏ธ Controls

  • Click or tap a pad โ€” or use 1 2 3 4
  • Q W A S work too, as do the arrow keys
  • P pause  โ€ข  R new game
  • Presses during the flashing are ignored โ€” wait for YOUR TURN.
  • ๐ŸŽฎ Xbox controller? Just plug it in or pair it โ€” the stick and D-pad are the arrow keys, A is SPACE, Menu pauses and View starts again

๐ŸŽฏ How to play

  • The game flashes a pattern of pads. Watch carefully.
  • When it says YOUR TURN, press the same pads in the same order.
  • Get it right and the pattern grows by one and flashes again.
  • One wrong pad ends the game โ€” so take your time on the early rounds.

๐Ÿ† Scoring

  • Finishing a round is worth 10 ร— the round number.
  • Round 1 flashes each pad for 620 ms; by round 15 it is down to 260.
  • Most people manage 5 or 6. Ten is genuinely impressive.
  • Tip: say the numbers out loud as they flash. It really works.

๐Ÿง‘โ€๐Ÿ’ป This whole game is Python

There is almost no JavaScript on this page. The browser downloaded Pyodide โ€” a complete Python interpreter compiled to WebAssembly โ€” and then ran the .py files in funtime/pylib/. Python does the rules, the maths and the drawing.

File What it does Good functions to try re-writing
pylib/simon_rules.py The rules: the sequence, the checking, the phases add_step, is_correct_so_far, press_pad, update_game
pylib/simon_draw.py Painting the pads โ€” Python calling the canvas draw_pad, pad_at_pixel, render_game
pylib/simon_web.py The glue: clicks, keyboard, the loop do_action, on_board_click, frame

๐Ÿ” Compare the two versions. Open lib/simon-rules.js and pylib/simon_rules.py side by side โ€” same ideas, two languages.

๐Ÿ› ๏ธ Build it yourself: Build Simon Says in Python walks you through the functions one at a time.

โš ๏ธ If the game never starts: the page has to read its .py files, which a browser will not do for a page opened straight off your disk. Use the live site, or run python3 -m http.server in the project folder.