Base Mission
9 points Live judgedA Small Red Cube is the Large Red Cube.
Introductory · SPIKE Coding Project 9
Your comments become real code. Change a number once, and the whole program changes with it.
Student PIN:
Open your Project 8 program — the big one with all four missions in it. Scroll through it slowly.
How many blocks contain each of these as a bare number?
| Count | |
|---|---|
| My arm’s “up” position | |
| My arm’s “down” position | |
| My claw’s “open” position | |
| My claw’s “closed on a cube” position | |
| My arm speed |
⚠ Your Teammate Rebuilt the Claw Last Night
It grips better now. But the closed position is different — it is 30 lower than it was.
Find every block that number lives in and change it. Time yourself.
| Question | Answer |
|---|---|
| How long did it take? | |
| How many blocks did you have to edit? | |
| Are you certain you got them all? |
That last question is the real problem. If you missed one, what would happen — and how would you find out?
This Gets Worse, Not Better
Your program is going to keep growing. By the time you are running a full match, that number could be in twenty blocks. There is a fix, it takes one block, and you are about to learn it.
A is a name that holds a value. You set it once at the top of your program, then use the name everywhere instead of the number.
Open the orange Variables category and press Make a Variable. Name it arm up. Two new things appear:
| Code / part | What it means |
|---|---|
| a round orange oval | The variable itself. This oval is the name — and it fits into any white number hole in any block. |
| a “set … to” block | Gives the name its value. |
The set blocks go at the very top of the stack — right under the hat, above everything else. Not scattered through the middle of your program. One place, all together, where anyone can find them.
You have been writing your positions on your Robot Card in name = number form since Project 7. There was a reason for that. Each line on the card becomes one variable and one set block:
| Code / part | What it means |
|---|---|
| card: up = 130 | Make a Variable named arm up → set arm up to 130 at the top of the stack. |
| card: closed = 55 | Make a Variable named claw closed → set claw closed to 55. |
Here is the part that feels like magic the first time: drag the orange oval and drop it into the white number hole of any block.
Read both versions out loud. One is a list of numbers. The other tells you what the robot is doing.
Five Reasons This Is Worth the Trouble
Make it obvious: arm up, not thing2. A name nobody can decode is barely better than a bare number.
The Leftover-Oval Check
The Variables shelf lists every variable you have made. A variable sitting on the shelf that never got dropped into a single block usually means one thing: somewhere in your stack, a bare number is still hiding. When you finish converting a program, read it top to bottom hunting for naked numbers.
Most of your variables hold one value forever — up is always up. But a variable is called a variable because it can vary. Two ways to change one:
Change by is the shorthand for “take what it holds and add this.” You will meet the real use for it in Project 10, once you have a loop to put it in.
Open your Arm Wave program from Project 7. Make variables for the three positions, set them at the top, then drop the ovals into the position blocks in place of the numbers.
Run it. It should behave exactly as before.
If it behaves differently, you swapped two values. That is the most common mistake here.
Make a variable called not used and never drop it into anything. Now look at your Variables shelf.
Delete it, so the shelf only lists names that are really in use.
This is the real job. Make all your variables, set them at the top, then work down the stack replacing bare numbers with ovals.
| Variable | My value | Done? |
|---|---|---|
| arm up | ||
| arm horizontal | ||
| arm down | ||
| claw open | ||
| claw closed | ||
| arm speed |
Convert One Mission Section at a Time
Same rule as building it in the first place. Convert one section, run it, then move on. Converting all four at once and finding it broken tells you nothing about where.
Same problem as Try It. Your claw’s closed position drops by 30. Change it.
| Question | Answer |
|---|---|
| How long did it take this time? | |
| How many places did you edit? |
Compare those two numbers with the ones you wrote in Try It.
Small experiment. Build this and watch the arm.
The arm moved in three hops instead of one jump. What would you have to do to make it move in thirty small hops?
Hold that thought. Project 10 gives you the tool that makes it three blocks instead of thirty.
Mission 5
A Small Red Cube is the Large Red Cube.
Both Small Red Cubes are the Large Red Cube.
This one asks your arm to reach higher than anything so far. The large red cube is the platform; the small ones go it.
Live Judged Is On Your Side Here
Robot support is permitted, and the cubes do not have to stay up there. Once the judge has seen it, it counts — even if it falls a second later.
⚠ Check What Mission 2 Did to These Cubes
In Project 6 you pushed the Large Red Cube, its , and both Small Red Cubes off the black line. Those are the same cubes you need here. Where they ended up decides how hard this is — so plan the two missions together, not separately.
Where do your red cubes end up after your Mission 2 push? Does that help or hurt you here?
The bonus needs both cubes up there at the same time. Why does that make the second one harder than the first?
| Run | First cube on top? | Both at once? | Points |
|---|---|---|---|
| 1 | |||
| 2 | |||
| 3 | |||
| 4 | |||
| 5 |
| Mission part | Scored? | Points |
|---|---|---|
| Mission 5 — Base (one small red cube on top) | 9 | |
| Mission 5 — Bonus (both small red cubes on top) | 11 | |
| My total | 20 |
For each card line, say what you would do in the app.
| Card line | In the app I would… |
|---|---|
| open = 145 | |
| down = 40 | |
| arm speed = 20 |
Given set arm down to 40 at the top of a stack — what does each of these do?
| Block | What it does |
|---|---|
| run C to position (arm down) degrees | |
| change (arm down) by -50 | |
| set (arm down) to (arm up) |
That last one is a legal block that does something you almost certainly do not want. Say what it actually does.
Nothing your robot does changed in this project — it drives, grabs, and stacks exactly as it did before. So what actually got better?
Variables fixed the problem of one number appearing in many places. But your program still has the six-step grab sequence built out four separate times. Would variables fix that too? Why or why not?
Your teammate opens your program for the first time. Which version could they work on — the one from Project 8, or this one? What does that tell you about who you are really writing programs for?
Your robot still cannot tell when it has arrived anywhere. It drives for a length of time and hopes.
In Project 10 — Feeling for Things, it gets its first sense: a switch that knows when it has touched something — and the loop that keeps checking.
Download saves a local copy of your answers. It does not turn in your work automatically; give the downloaded file to your teacher.
KIPR · Botball Explorer — Introductory Projects · © KISS Institute for Practical Robotics 1997–2026