0

The shortest program

  1. repeat 4 times
    move up

    Fewer blocks

    Robots like short programs. Four move up blocks would work here. One repeat block with move up inside is shorter.

  2. repeat 5 times
    move right
    collect the star

    One straight line, one repeat

    Look for a straight line of moves. The star is 5 squares right. One repeat block does the whole line.

  3. repeat 3 times
    move down
    repeat 4 times
    move right

    A turn starts a new repeat

    When the robot turns, start a new repeat. This robot goes down 3, then right 4. Two repeats do it all.

  4. repeat 4 times
    move right
    repeat 3 times
    move up

    Find the gap

    Rocks block the way up. Find the gap first. It is on the right side. Go right 4, then up 3.

  5. Beat the par

    Count your blocks before you run. Every lab has a par number. Use that many blocks or fewer to win 3 stars.

For parents

Goal: Your child learns to make programs shorter by using one repeat block for each straight line of moves.

  • Ask: where does the robot turn? Each turn starts a new repeat.
  • Ask your child to count the blocks in their program and compare it with the par.
  • The labs are robot puzzles with a par. Three stars go to the shortest programs, so let your child try again for a better score.

Away from the screen: Make a path on the floor with tape that has one turn. Your child says the program, like repeat 4 times step forward, then repeat 2 times step left, then walks it.

Coding · Loops
Back to top