Conditions for kids: MRT Station
Wait for the fare gates and train doors. Timing is everything.
Free · no sign-up · ages 6–12 · works on Chromebooks and iPads
What are conditions?
A condition lets a program make a decision: if something is true, do one thing; otherwise (else), do something different. Conditions are how programs react to the world. A game checks if you pressed jump, and a traffic light checks if a car is waiting.
At the MRT station, the fare gates and train doors open and shut on a timer. Your robot can't walk through a shut gate, and it can't board while the doors are closed. You could count the exact number of waits, but then your program only works for one timetable. Using "if the gate is shut, wait, else move" gives you a program that works whenever the robot arrives.
This world also brings in "repeat until finished", a loop that keeps going until the job is done instead of a fixed number of times. Putting a condition inside that loop is one of the most common patterns in real code. Programs check, act, and check again.
The levels
- Level 1 Mind the Doors Walk to the train. The doors are shut when you arrive, so use "wait" until they open.
- Level 2 Long Platform A really long platform. Try the new "repeat until finished" block. It keeps going until the robot is on the train.
- Level 3 Doors Open? The doors stay shut for a long time. Teach the robot to check: if the doors are open, board; else, wait.
- Level 4 Fare Gates Tap in! The fare gates open and shut. Only walk when the gates are open.
- Level 5 Down to the Platform Take the stairs down to the platform first, then wait for the train doors.
- Level 6 Rush Hour Gates AND doors! Only move when the gates are open and the doors are open too.
- Secret bonus Last Train Home Get three stars on all six levels to unlock it.
Teachers: link straight to any level, like dotcodecampus.com/maze/mrt/3, and put it up on the projector.
Ready to Start Building?
Book a free 45-minute trial class. No commitment, no credit card — just great learning.
