Smart Home League
Step-by-step Lesson Booklet — First Step (Elementary)
6 LESSONS
Install & run
The Smart Home League folder you received contains two sub-folders: Windows and Mac.
Windows
- Open the Windows folder and double-click
Smart Home League.exe.
- If Windows shows a security prompt the first time, choose More info → Run anyway.
- The game window opens by itself — that is all.
Mac
- Open the Mac folder and double-click
Smart Home League (Mac).command.
- If macOS refuses: right-click the file → Open → Open (needed only once).
- If macOS offers to install its command-line tools (python3), click Install, then double-click again.
Inside the app: the language switches from the ☰ menu; the base code, the helpers and Match mode sit on each league's front page, and the full rulebook opens from the Rules button.
The helpers — code-building tools
The league's front page offers two helpers. Both end by producing a real Python file — exactly what the match runs.
🤖 The AI helper (question-and-answer rule builder)
- Open AI helper from the league's front page.
- Tap (or drag) a sensor on the robot picture — a rule is created.
- Answer its questions: closer than how many centimetres? which way should the robot go? how fast, for how long?
- Add an optional second move (for example: back away, then turn).
- Watch the little simulator room act out your rules live.
- The generated Python appears below — the yellow numbers are editable right inside the code.
- Press ▶ Play with this code — the match starts by itself. ⬇ Download .py saves the file.
🧩 The Blocks helper (puzzle pieces)
- Open Blocks helper from the front page.
- Pick an "if …" (sensor) block and a move block from the palette — the pieces snap together like a puzzle.
- + New rule at the top creates a fresh rule; after each condition a blinking prompt asks: another condition, or a move?
- Blocks and the AI helper share one rules file — build in either, continue in the other; you can even load a Python file back into blocks.
- Press ▶ to run the same code in the match.
The robot's sensors at a glance
- Three ultrasonic distance sensors (US) —
front straight ahead, frontleft to the front-left, frontright to the front-right; in centimetres, smaller means closer.
- The bumper —
bumperfront for a front hit and bumperback for a hit from behind (0 or 1).
- The colour sensor —
color: the floor colour just ahead (white, green, purple, …).
The ultrasonic distance sensors (US): front looks straight ahead, frontleft front-left, frontright front-right — the orange arc is the touch bumper
Before you start
The golden rule: the robot program runs 10 times a second, top to bottom; whatever you put in wheelleft / wheelright holds until the next run. Every lesson is a complete runnable program — run it in the in-app Tutorial or paste it into the match editor.
Lesson 1 — The ultrasonic distance sensors
The FS robot has three forward distance sensors that report distance in centimetres: frontleft, front and frontright. A smaller number means closer (200 is the maximum). This robot is driving toward the wardrobe — tell it what to do when the wall gets close, press ▶ and watch the front number fall in the panel below.
wheelleft = 25
wheelright = 25
if front < 50: # a wall closer than 50 cm
wheelleft = 0 # -> stop
wheelright = 0
You should see: the robot drives east and stops about half a metre before the wardrobe. Replace 50 with 80 or 25 and run again — it stops earlier or later.
Lesson 2 — See left and right separately
The middle sensor (front) cannot see everything! frontleft looks slightly left and frontright slightly right. With these two you can STEER instead of stopping: whichever side sees an obstacle, curve away to the other side.
wheelleft = 25
wheelright = 25
if front < 55: # blocked straight ahead
wheelleft = 18 # -> spin right on the spot
wheelright = -18
elif frontleft < 45: # obstacle on the left
wheelleft = 25 # -> curve right
wheelright = 8
elif frontright < 45: # obstacle on the right
wheelleft = 8 # -> curve left
wheelright = 25
You should see: the robot tours the house without stopping, curving past the furniture. Raise the 45s to 70 — it grows more cautious but paints fewer tiles. That trade-off is the heart of the match!
Lesson 3 — The colour sensor
Under the robot's nose sits a colour sensor that reads the floor just ahead. Compare it with the ready-made names: white (dirty floor — points!), red / blue (already cleaned), green (the big rug), purple (a small rug), black (a wall). This robot faces the green rug — make it react the moment it sees green.
wheelleft = 25
wheelright = 25
if color == green: # the green rug is right ahead
wheelleft = 25 # -> turn away from it
wheelright = -25
You should see: the robot drives north and, the instant the panel says green, it turns away from the rug. Swap -25 and 25 to turn left instead. Note the turn only lasts WHILE green is ahead — for a move that keeps going, see the next lesson!
Lesson 4 — The two-half bumper
The ring around the robot feels touch and says WHICH half was hit: bumperfront means I hit with my front, bumperback means I was hit from behind. The FS golden rule: hit from behind, reversing only pins you harder — the escape is FORWARD! This robot drives blind; rescue it with the bumper alone.
wheelleft = 25
wheelright = 25
if timer > 0: # still mid-manoeuvre
timer -= 1
if state == 2:
wheelleft = -25 # curved reverse
wheelright = -8
else:
wheelleft = 25 # forward + turn
wheelright = -10
elif bumperfront == 1: # I hit with my front
state = 2 # -> back away
timer = 7
elif bumperback == 1: # hit from behind
state = 1 # -> escape FORWARD!
timer = 6
You should see: the robot bumps into something, bumperfront flips to 1 in the panel, and it backs away in a curve. If it is ever hit from behind, it escapes forward instead of being crushed. Make timer = 7 bigger for a longer manoeuvre.
Lesson 5 — timer: a move that lasts
Setting the wheels lasts only ONE step (0.1 s) — next step your code runs again from the top! For a lasting move: put a number in timer, and the "if timer > 0:" block above the logic keeps that same move going step by step. 10 steps = 1 second.
wheelleft = 25
wheelright = 25
if timer > 0: # still reversing
timer -= 1
wheelleft = -25
wheelright = -18 # curved reverse
elif color == green: # the green rug!
timer = 10 # 10 steps = 1 second of reverse
wheelleft = -25
wheelright = -18
You should see: at the rug it reverses for one FULL second — even after green has left the sensor. Change timer = 10 to 30 and see the difference. Watch timer count down live in the panel.
Lesson 6 — Easy moves
The simplest way: ONE call is the whole move, and its number is REAL SECONDS. backward(2) means exactly two seconds of reverse. You also have forward(1), turnleft(1), turnright(1) and stop(1). While a move runs, your wheel lines are ignored; when it ends, your normal code takes over again.
wheelleft = 25
wheelright = 25
if color == green: # the green rug ahead
backward(2) # two real seconds of reverse
elif bumper == 1: # I hit something
backward(1)
elif front < 50: # a wall is close
turnright(1) # spin right for one second
You should see: at the rug, backward(2) reverses for two full seconds; near walls turnright(1) spins it away. Change the numbers: backward(5), turnright(0.5) — halves work too, the number is always seconds!