Today’s mission 5 min
Read a rule you have never seen, change the robot and the code, and score with it in 30 minutes, with no help.
At WRO a surprise rule is announced on competition day. Nobody knows it in advance, including your coach. Teams that panic lose the time. Teams that have practised read it, plan, and change one small thing.
Check this season’s General Rules for how the surprise rule is announced and how long you get. Today’s time box is 30 minutes.
The idea — read, plan, change, test 10 min
When the rule arrives, follow four steps. Do not skip to step 3.
- Read (3 min). Both of you read it twice. Each says it back in your own words. If you disagree about what it means, decide together and write your reading down.
- Plan (5 min). Which mission does it touch? Is it a robot change, a code change, or both? What is the smallest change that obeys the rule?
- Change (15 min). Make that change. Run only the mission it affects, not the whole run.
- Test (7 min). Run it twice. If it fails, decide: fix, or leave that mission out. Do not start a big rebuild in the last ten minutes.
Code that is easy to change. Keep every number a rule might touch at the top of the program, in capital letters. Python calls these constants. A rule that changes a zone or a wait is then a one-line edit.
Blocks vs Python 10 min
Both programs keep their settings in one place, at the top. A surprise rule changes the settings, not the moves.
SPIKE word blocks
when program starts :: events hat set [drop distance v] to (40) :: variables set [pause time v] to (0) :: variables move [↑ v] for (drop distance :: variables) [cm v] :: movement wait (pause time :: variables) seconds deliver :: myblocks
Pybricks Python
from pybricks.tools import wait from base import robot, deliver # ---- settings: a surprise rule changes these ---- DROP_DISTANCE = 400 # mm PAUSE_TIME = 0 # ms # ------------------------------------------------- robot.straight(DROP_DISTANCE) wait(PAUSE_TIME) deliver()
| Block | Python | Watch out |
|---|---|---|
| set drop distance to 40 | DROP_DISTANCE = 400 | SPIKE movement uses cm. Pybricks uses mm: multiply by 10. |
| (variable name) | CAPITAL_LETTERS | Capitals tell the reader: set once here, never changed below. |
| wait (pause time) seconds | wait(PAUSE_TIME) | Milliseconds again. |
SPIKE word blocks
Pybricks Python
SURPRISE_STOP_ON_LINE = True def first_leg(): robot.straight(300) if SURPRISE_STOP_ON_LINE: robot.stop() wait(2000) robot.straight(200)
| Block | Python | Watch out |
|---|---|---|
| (nothing) | SURPRISE_STOP_ON_LINE = True | True and False have capital letters in Python. |
Keep the old behaviour behind a switch instead of deleting it. If the change goes badly, set the switch to False and you have your working program back.
Get ready for the card 10 min
Before the card is opened, prepare your program:
- Save a backup. Export your mission programs from Pybricks Code and keep the copy somewhere safe. If the surprise change breaks everything, you need the old version back in one minute.
- Move the numbers to the top. Every distance, angle, speed, wait and colour threshold in each mission goes into a settings block.
- Name them clearly.
TOWER_TURN = 90says more thanA = 90. - Run once. The program must behave exactly as before. You moved numbers; you changed nothing.
Test and measure 10 min
A warm-up rule, written by your partner team:
- Each team writes one small rule on paper for the team next to them. It must be fair and doable in ten minutes.
- Swap, then apply the rule using only your settings block or a switch.
- Time how long it took. If you had to edit below the settings block, which number had you missed? Move it up now.
Break it, fix it 5 min
These are mistakes made in a hurry, under a surprise rule. One mistake each.
Bug 1
DROP_DISTANCE = 400 robot.straight(drop_distance) deliver()
Bug 2
SURPRISE_STOP_ON_LINE = true
if SURPRISE_STOP_ON_LINE:
robot.stop()Bug 3
PAUSE_TIME = 2 # the rule says wait 2 seconds robot.straight(300) wait(PAUSE_TIME) robot.straight(200)
Bug 3 gives no error. The robot simply does not obey the rule. That is how a surprise rule costs points without anyone noticing.
Solo challenge — the surprise rule 35 min
No coach, no help. At WRO your coach may not touch the robot or the code. Close this page. You may use your own earlier programs and the Pybricks documentation, nothing else.
Your coach hands you a sealed rule card and starts the clock. You have 30 minutes from opening it to your first scored run. Your coach will not explain the card.
- Read, plan, change, test, as in the idea section.
- Write your reading of the rule in one sentence, first.
- At 30 minutes, put the robot in base and run. Then use the last 5 minutes for one more run.
Done means: a scored run that obeys your written reading of the rule, inside the time box, with no help asked for.
Engineering journal 5 min
Today’s entry:
- the rule card, copied word for word, and your reading of it
- the change you made: robot, code or both
- minutes from opening the card to the first working run
- which number you had to hunt for, and where it lives now
- what you would do differently with the next card