Platforms tested: macOS.
tkinteris cross-platform, so Linux, FreeBSD, and Windows (incl. ARM64) are expected to work and are planned for testing — not yet verified.
The "Three Cups" shell game, built up in stages with Python's standard-library
tkinter GUI toolkit. A blue ball is hidden under one of three cups; a sequence
of swaps (A = Left/Middle, B = Middle/Right, C = Left/Right) shuffles them,
and you work out where the ball ended up.
| File | What it adds |
|---|---|
three_cups.py |
The pure logic — hide the ball, apply swaps, find the ball (no GUI). |
three_cups_gui.py |
A first tkinter window using text-box "cups". |
three_cups_canvas.py |
Real cup shapes drawn on a Canvas; redraw-from-state each frame. |
three_cups_animated.py |
Swaps play out over time with root.after() (no freezing). |
three_cups_interactive.py |
Full game: ball hidden during play, green/blue "Roswell" dots blink over each swapping pair, and after the run you click a cup to lift it — the ball flashes 7× if found, otherwise the cup is empty. |
python3 three_cups_interactive.pyRequires Python 3 with tkinter (included in standard CPython on macOS/Windows;
on some Linux distros install python3-tk).
tkinter ships with CPython but the Tk runtime is sometimes a separate package.
Only that install step differs; the run command is the same everywhere:
| OS | Install Tk | Run |
|---|---|---|
| Linux (Debian/Ubuntu) | sudo apt install python3 python3-tk |
python3 three_cups_interactive.py |
| Linux (Fedora) | sudo dnf install python3 python3-tkinter |
python3 three_cups_interactive.py |
| Linux (Arch) | sudo pacman -S python tk |
python3 three_cups_interactive.py |
| FreeBSD | pkg install python3 py3XX-tkinter |
python3 three_cups_interactive.py |
| Windows (incl. ARM64) | install Python from python.org (Tk is bundled) | py three_cups_interactive.py |
(On FreeBSD the py3XX-tkinter name tracks your Python version, e.g.
py311-tkinter.)
Functional check (same on every OS):
- Pick a cup — it lifts and the ball flashes 7×.
- Enter swaps (e.g.
ABCAB) and press Play — green/blue dots blink over each pair. - When done, click a cup — the ball flashes 7× if found, else "Nothing under that cup."
When a platform passes, flip its badge from planned-lightgrey to
tested-2ea44f (and add the matching topic).
The same game also exists in SwiftUI and C++/wxWidgets.