> ## Documentation Index
> Fetch the complete documentation index at: https://docs.primastem.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Chapter 4. Debugging step by step

> Book 2. Activities 4.1 and 4.2.

For printing: [PDF of the whole book, A4](https://github.com/primastem/mintlify-docs/raw/main/en/book-2/files/book-2.pdf)

Chapter task: a repair workshop. A drawing came out faulty. The workshop finds the pair that spoiled it and changes one token.

In Book 1 the children looked for a wrong, missing or extra command. Here there are three new types of errors: wrong number, wrong angle, wrong side of the turn.

The [Debugging steps card](https://docs.primastem.com/en/book-2/card-protocol.md) stays on each group's table until the end of the course:

1. Predict: draw in pencil what should come out.
2. Run.
3. Compare the robot's drawing with the prediction.
4. Find the first pair after which the robot went wrong.
5. Change one token and run again.

## Activity 4.1. The first wrong pair

**We draw.** A fixed digit 4.

### Goals

**The child can.** Go through the debugging steps and name the number of the first wrong pair.

**New.**

* The five debugging steps.

### Materials

Debugging steps card, a 1 cm grid sheet with a frame 100 × 100, one A3 sheet for the faulty drawing and two A4 sheets per group, a pencil, a ruler.

Tokens: Forward (3), Backward (2, the second one for “Find the error”), Left, Right (2); numbers 100 (2), 40, 60. For the own task, the tokens of a letter from chapter 1. For fast finishers, Function, × 3, × 4.

### For printing

* [Debugging steps card](https://docs.primastem.com/en/book-2/card-protocol.md), one per group.
* [1 cm grid sheet](https://docs.primastem.com/en/book-2/sheet-blank-1cm.md), one per child.

### Lesson steps

1. Opening, 5 min. The teacher shows the digit 4 from 1.3 and the faulty drawing next to it: “A customer brought us this. Today we fix it.”
2. Body, 3 min, optional. The teacher plays the robot and walks the correct 4 by the program on the whiteboard. After the third pair the class says which way the teacher faces.
3. Predict, 7 min. Debugging step 1: draw the correct 4 on the grid sheet. Guess: at which pair does the robot go wrong?
4. Robot, 20 min. Steps 2–5 on the program with an error. The Checker moves a finger along the prediction and says “stop”. The Programmer names the pair that blinks. If there is time left, own task: the group changes one token in its letter from chapter 1 (Left to Right, one length number to another, or one repeat to another). The group gives it to the neighbors with a drawing of the correct letter. The neighbors fix it with the debugging steps.
5. Show, 7 min. For the notebook: “I look for the first wrong pair. I change one token.” The fixed 4s go on the floor, then home.

### Program with an error

It should be a 4. Start: the top-right corner of the frame, the robot faces down.

Board: top row Forward 100, Backward 40, Left, Forward 100, Right, Forward 60.

[Run in the simulator](https://simulator.primastem.com/#top=cfor.n100,cbac.n040,clef,cfor.n100,crig,cfor.n060\&s=l1047402\&r=250-240-180\&run)

![](https://mintcdn.com/primastem/L6aXBzUhirm1VwzK/images/book-2/lessons/b2-4-1-0-board.svg?fit=max\&auto=format\&n=L6aXBzUhirm1VwzK\&q=85\&s=e485aea958e175c89f0a3dd299a5b9c5)

Program on the board

![](https://mintcdn.com/primastem/L6aXBzUhirm1VwzK/images/book-2/lessons/b2-4-1-0-field.svg?fit=max\&auto=format\&n=L6aXBzUhirm1VwzK\&q=85\&s=7eb6b2db8c3a04b3b2866267a5f519c1)

What the robot draws

### Fixed program

Same start.

Board: top row Forward 100, Backward 40, Right, Forward 100, Right, Forward 60.

[Run in the simulator](https://simulator.primastem.com/#top=cfor.n100,cbac.n040,crig,cfor.n100,crig,cfor.n060\&s=l1047402\&r=350-250-180\&run)

![](https://mintcdn.com/primastem/L6aXBzUhirm1VwzK/images/book-2/lessons/b2-4-1-1-board.svg?fit=max\&auto=format\&n=L6aXBzUhirm1VwzK\&q=85\&s=d577cf38704bfbb9227f2cc5176ca413)

Program on the board

![](https://mintcdn.com/primastem/L6aXBzUhirm1VwzK/images/book-2/lessons/b2-4-1-1-field.svg?fit=max\&auto=format\&n=L6aXBzUhirm1VwzK\&q=85\&s=97bd01d64f93c9c304bcf28c5866d31c)

What the robot draws

### Answer

The first wrong pair is the third one: Left instead of Right. It draws nothing itself, but on it the robot turns the wrong way, and you can see that. The crossbar went to the right of the upright, and the stick went down: the result is a hook 100 × 120 mm. After the repair the digit is 100 × 100. The robot stands on the top end of the left stick and faces up.

### Find the error

Petya saw that the crossbar went the wrong way on the fourth pair. He changed Forward 100 in it to Backward 100. What came out? (The crossbar lay to the left, as it should, but the stick went down: the robot still faces right, the turn is still wrong. Fix the first wrong pair, the third one.)

Board: top row Forward 100, Backward 40, Left, Backward 100, Right, Forward 60.

[Run in the simulator](https://simulator.primastem.com/#top=cfor.n100,cbac.n040,clef,cbac.n100,crig,cfor.n060\&s=l1047402\&r=350-240-180\&run)

![](https://mintcdn.com/primastem/L6aXBzUhirm1VwzK/images/book-2/lessons/b2-4-1-2-board.svg?fit=max\&auto=format\&n=L6aXBzUhirm1VwzK\&q=85\&s=3dc0d44481817821c9dcd6f402bffee0)

Program on the board

![](https://mintcdn.com/primastem/L6aXBzUhirm1VwzK/images/book-2/lessons/b2-4-1-2-field.svg?fit=max\&auto=format\&n=L6aXBzUhirm1VwzK\&q=85\&s=8bfad50c6f619ec57c9eafb336f41315)

What the robot draws

### For fast finishers

It should be a C, but an O came out. Start: the top-right corner of the frame, the robot faces left. How many sides are extra? Which token causes this? (One extra side. The repeat in the first pair causes it: you need Function × 3. This is a wrong number. We fix the same kind of wrong number in 4.2.)

Board: top row Function × 4. Bottom row: Forward 100, Left.

[Run in the simulator](https://simulator.primastem.com/#top=cfun.r004\&fn=cfor.n100,clef\&s=l1047402\&r=350-250-270\&run)

![](https://mintcdn.com/primastem/L6aXBzUhirm1VwzK/images/book-2/lessons/b2-4-1-3-board.svg?fit=max\&auto=format\&n=L6aXBzUhirm1VwzK\&q=85\&s=65e642ea6c4bbd60400012a01a98a73d)

Program on the board

![](https://mintcdn.com/primastem/L6aXBzUhirm1VwzK/images/book-2/lessons/b2-4-1-3-field.svg?fit=max\&auto=format\&n=L6aXBzUhirm1VwzK\&q=85\&s=abc10dc9c0a4602ef9ebcada3d542ef2)

What the robot draws

## Activity 4.2. Repair workshop

**We draw.** A fixed hedgehog, star and letter L.

### Goals

**The child can.** Name the type of error (number, angle, side) and fix it with one token.

**New.**

* Three types of errors: number, angle, side. Number here means how many: how many times to repeat or how many millimeters to drive.

### Materials

Debugging steps card, two A3 sheets (hedgehog and star) and one A4 sheet (L) per group, a 1 cm grid sheet, a pencil, the simulator on the whiteboard.

Tokens: Function; × 4, × 8, × 6; Forward (2), Backward, Left, Right; numbers 100 (2), 45, 90, 135, 150.

### For printing

* [Debugging steps card](https://docs.primastem.com/en/book-2/card-protocol.md), one per group.
* [1 cm grid sheet](https://docs.primastem.com/en/book-2/sheet-blank-1cm.md), one per child.

### Lesson steps

1. Opening, 5 min. The teacher opens three faulty orders in the simulator: half a hedgehog, a square instead of a star, a mirrored L. “The workshop is open. We fix everything by the end of the lesson.” Without a projector, show the three faulty drawings from the book.
2. Body, 3 min, optional. Everyone stands up and makes four eighth turns on the spot. Where do we face? (Backwards.) And after eight?
3. Predict, 7 min. Debugging step 1 for each order: what drawing should come out? Find the first wrong pair and the type of error. Guess: which of the three orders do the children fix first?
4. Robot, 20 min. The group lays out the program of an order, changes one token and runs it. The customer already showed the faulty drawing in the simulator, so the group runs each order only once, already fixed. The Measurer writes on the back of the sheet: the pair number, the type of error, what they changed.
5. Show, 7 min. For the notebook: “Three types of errors: number, angle, side.” The three drawings go on the floor, then home.

### Programs with an error

#### Should be a hedgehog

Start: the center of the A3 sheet, the robot faces up.

Board: top row Function × 4. Bottom row: Forward 100, Backward 100, Right 45.

[Run in the simulator](https://simulator.primastem.com/#top=cfun.r004\&fn=cfor.n100,cbac.n100,crig.n045\&s=l1047402\&r=250-315-0\&run)

![](https://mintcdn.com/primastem/L6aXBzUhirm1VwzK/images/book-2/lessons/b2-4-2-0-board.svg?fit=max\&auto=format\&n=L6aXBzUhirm1VwzK\&q=85\&s=c33519a6a629aaef5c01709d2e9a7cc5)

Program on the board

![](https://mintcdn.com/primastem/L6aXBzUhirm1VwzK/images/book-2/lessons/b2-4-2-0-field.svg?fit=max\&auto=format\&n=L6aXBzUhirm1VwzK\&q=85\&s=45bd7c02796395fa618041725cee7cda)

What the robot draws

#### Should be a star

Start as in 2.3: A3 sheet, 10 cm from the left edge and 10 cm from the top edge, the robot faces right.

Board: top row Function × 8. Bottom row: Forward 150, Right 90.

[Run in the simulator](https://simulator.primastem.com/#top=cfun.r008\&fn=cfor.n150,crig.n090\&s=l1047402\&r=225-225-90\&run)

![](https://mintcdn.com/primastem/L6aXBzUhirm1VwzK/images/book-2/lessons/b2-4-2-1-board.svg?fit=max\&auto=format\&n=L6aXBzUhirm1VwzK\&q=85\&s=49b21be8a76eb8054125320c8fc2f971)

Program on the board

![](https://mintcdn.com/primastem/L6aXBzUhirm1VwzK/images/book-2/lessons/b2-4-2-1-field.svg?fit=max\&auto=format\&n=L6aXBzUhirm1VwzK\&q=85\&s=82a57b505e749e2a678c3d1c01d690ce)

What the robot draws

#### Should be an L

Start: the top-left corner of the frame, the robot faces down.

Board: top row Forward 100, Right, Forward 100.

[Run in the simulator](https://simulator.primastem.com/#top=cfor.n100,crig,cfor.n100\&s=l1047402\&r=350-250-180\&run)

![](https://mintcdn.com/primastem/L6aXBzUhirm1VwzK/images/book-2/lessons/b2-4-2-2-board.svg?fit=max\&auto=format\&n=L6aXBzUhirm1VwzK\&q=85\&s=6cb959be2e62647877bb93507f2643e6)

Program on the board

![](https://mintcdn.com/primastem/L6aXBzUhirm1VwzK/images/book-2/lessons/b2-4-2-2-field.svg?fit=max\&auto=format\&n=L6aXBzUhirm1VwzK\&q=85\&s=f5fe84fcbf042551d569bef0cf0475a2)

What the robot draws

### Fixed programs

#### Hedgehog

Board: top row Function × 8. Bottom row: Forward 100, Backward 100, Right 45.

[Run in the simulator](https://simulator.primastem.com/#top=cfun.r008\&fn=cfor.n100,cbac.n100,crig.n045\&s=l1047402\&r=300-300-0\&run)

![](https://mintcdn.com/primastem/L6aXBzUhirm1VwzK/images/book-2/lessons/b2-4-2-3-board.svg?fit=max\&auto=format\&n=L6aXBzUhirm1VwzK\&q=85\&s=1f690a5c37ba1e1a8179442377e4df69)

Program on the board

![](https://mintcdn.com/primastem/L6aXBzUhirm1VwzK/images/book-2/lessons/b2-4-2-3-field.svg?fit=max\&auto=format\&n=L6aXBzUhirm1VwzK\&q=85\&s=e2bb848627717abb175882958c04dfb0)

What the robot draws

#### Star

Board: top row Function × 8. Bottom row: Forward 150, Right 135.

[Run in the simulator](https://simulator.primastem.com/#top=cfun.r008\&fn=cfor.n150,crig.n135\&s=l1047402\&r=225-269-90\&run)

![](https://mintcdn.com/primastem/L6aXBzUhirm1VwzK/images/book-2/lessons/b2-4-2-4-board.svg?fit=max\&auto=format\&n=L6aXBzUhirm1VwzK\&q=85\&s=ff27707c5d550c76cb73c8c1c1714f8e)

Program on the board

![](https://mintcdn.com/primastem/L6aXBzUhirm1VwzK/images/book-2/lessons/b2-4-2-4-field.svg?fit=max\&auto=format\&n=L6aXBzUhirm1VwzK\&q=85\&s=2b246ead8ee238055f883e3a570a50b6)

What the robot draws

#### L

Board: top row Forward 100, Left, Forward 100.

[Run in the simulator](https://simulator.primastem.com/#top=cfor.n100,clef,cfor.n100\&s=l1047402\&r=250-250-180\&run)

![](https://mintcdn.com/primastem/L6aXBzUhirm1VwzK/images/book-2/lessons/b2-4-2-5-board.svg?fit=max\&auto=format\&n=L6aXBzUhirm1VwzK\&q=85\&s=0caa6f72debfbd36387890bb44a6074d)

Program on the board

![](https://mintcdn.com/primastem/L6aXBzUhirm1VwzK/images/book-2/lessons/b2-4-2-5-field.svg?fit=max\&auto=format\&n=L6aXBzUhirm1VwzK\&q=85\&s=e3fb0d17ca8e3c9153685ae3044e322f)

What the robot draws

### Answer

Hedgehog: the first pair, × 4 instead of × 8, wrong number. The result is four rays on one side, 100 × 171 mm, and 200 × 200 after the repair. Star: the second pair of the bottom row, 90 instead of 135, wrong angle. The result is a 150 × 150 square, and the robot went around it twice. L: the second pair, Right instead of Left, wrong side. The result is a mirrored L, with the bar to the left of the upright.

### Find the error

Kirill fixed the hedgehog. He changed Right 45 to Right 90 but kept × 4. What came out? (A cross of four rays, 200 × 200 mm. The drawing is whole, but it is not a hedgehog. The first pair was wrong, and Kirill changed a different one.)

Board: top row Function × 4. Bottom row: Forward 100, Backward 100, Right 90.

[Run in the simulator](https://simulator.primastem.com/#top=cfun.r004\&fn=cfor.n100,cbac.n100,crig.n090\&s=l1047402\&r=300-300-0\&run)

![](https://mintcdn.com/primastem/L6aXBzUhirm1VwzK/images/book-2/lessons/b2-4-2-6-board.svg?fit=max\&auto=format\&n=L6aXBzUhirm1VwzK\&q=85\&s=6e24788204ee8f33367c8410c52f9ec0)

Program on the board

![](https://mintcdn.com/primastem/L6aXBzUhirm1VwzK/images/book-2/lessons/b2-4-2-6-field.svg?fit=max\&auto=format\&n=L6aXBzUhirm1VwzK\&q=85\&s=351770317aca5d8edbfffa89f89c2fcd)

What the robot draws

### For fast finishers

An order for the neighbors. Take the program of a hedgehog, a star or a polygon from chapters 2–3 and change one token: the repeat or the turn number. Draw on paper what should come out and give it to the neighbors. Example: a hedgehog with Function × 6 instead of × 8. You get six rays out of eight, 171 × 200 mm.

Board: top row Function × 6. Bottom row: Forward 100, Backward 100, Right 45.

[Run in the simulator](https://simulator.primastem.com/#top=cfun.r006\&fn=cfor.n100,cbac.n100,crig.n045\&s=l1047402\&r=285-300-0\&run)

![](https://mintcdn.com/primastem/L6aXBzUhirm1VwzK/images/book-2/lessons/b2-4-2-7-board.svg?fit=max\&auto=format\&n=L6aXBzUhirm1VwzK\&q=85\&s=302bc0786ba5c02dccb672fac8dc9824)

Program on the board

![](https://mintcdn.com/primastem/L6aXBzUhirm1VwzK/images/book-2/lessons/b2-4-2-7-field.svg?fit=max\&auto=format\&n=L6aXBzUhirm1VwzK\&q=85\&s=827ec6475c67df6e897cbb32c9dbb145)

What the robot draws

Next activity: [Test 1](https://docs.primastem.com/en/book-2/test-1.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.