# Optimized Cargo Bots (Age 7)

## The Acitivites

1. Topic: Algebra. Book: Safari Park by Murphy.  5 kids each get 20 tickets to spend on amusement park rides. Work out simple algebra problems to figure out how many tickets each kid has left.

2. Topic: Algebra. I made several worksheets with simple algebra problems. I divided them by difficulty into three levels. Level One was problems like: 3 + X = 30. A Level Two problem was 3 * X = 15.  Level Three problems were 2 * X + 5 = 25.  Here are the problem worksheets.

3. Topic: Programming. We continued with Cargo Bot programming problems this week.  Move a stack of 3 blocks from square A to square F. Then ask the kids if there are any repeated sections, and introduce sub-programs. What’s the shortest program that can solve the problem?

## How did it go?

We had three kids this week. It was a quiet, focused circle.  My daughter has been crying a lot during circle recently (much to her disappointment), and she did much better this time.  What a relief! She loves circle, but gets very upset if it doesn’t go how she expects.

#### Algebra

We did algebra problems about six months ago, and the kids are much, much better at it now. After each kid finished a worksheet, they could either move up to a harder problems, or choose to do another sheet of the same level.

My daughter decided to do two Level One worksheets before moving up. The other two kids moved up a level after each worksheet.  One girl sped through the problems, finishing her Level 3 sheet with essentially no help before the others had finished Level 2.  She worked on the other Level 3, and also the easier levels while the other two kids finished.

Two problems on Level 3 were: X * 0 = 0, and X / X = 1.   Each kid put down an answer for X, e.g. X = 3.  I asked if they were sure X was 3, and they said yes, 3 works.  I asked if X could be anything else, and eventually they realized that X could be any number.  I suggested putting a question mark down in those boxes.

#### Cargo Bots

There’s an App called Cargo Bots about a machine moving boxes around a warehouse. We used pen and paper to solve Cargo-Bot-like problems.  There are three commands: Left (L), Right (R), and Drop (D) which picks up or drops a box.

The first problem was easier than last week’s question…they just had to move a stack of identical boxes from square A to square F.  Two of the kids immediately wrote out correct (long) programs to do this. The third kid complained that the program would be very long.  I checked her progress, and it turned out she had written code to move the whole stack of blocks from square A to square B.  She was then going to move them all to square C.  I suggested she could move them directly to Square F.

Meanwhile, my daughter noticed repetitive parts of her program, so she replaced the strings of “L, L, L, L, L” with: “Do L 5 Times”.  She then proudly announced that her program was only 11 lines long now.  This was a great insight, but I had been planning to do subprograms with a different syntax.  My daughter was rather upset when I tried to explain that the robot arm didn’t understand the command “D L 5 Times.”  After a minute of discussion, she finally calmed down and we moved on.

Our subprogram syntax was to write a ‘1’ off to the side. Subprogram ‘1’ could contain any basic commands.  For example: 1 = “L L L L L”.  Then we could erase any string of 5 Ls in our main program with ‘1’.  To count the length of a program, you count each line of the main program, plus all the lines in the subprograms.

I then assigned a new task: Move 3 blocks from box C to box A, and try to make the shortest possible program.  Here’s my daughter’s solution:

The other two kids took a bit longer to solve this, but made good progress on their own.  One girl had two subprograms, which added up to 12 lines.  My daughter helped her try to get down to 9 lines.  In the course of the help, the girls realized that it was impossible to do it in 9 lines, and that my solution had a bug…I was missing the final ‘D’ in the main program.  This made them very happy.