โ† LessonsBUILDER PATH ยท 7โ€“9๐Ÿค–

Robot Bubble Belt

LESSON 147
๐ŸŽฏ Today's missions
๐Ÿค–โš™๏ธ๐Ÿ”ง
ROBOT FACTORY

Robot Bubble Belt

Six robots roll down the conveyor belt in a jumble. The packing door only takes them lightest to heaviest. The belt arm can only look at two neighbors at a time. Teach it to sort the whole line.

๐Ÿง  Before we start

Reef Pointer Pairs needed a list that was already sorted. Today we make the sorted list! Bubble sort compares two neighbors, swaps them if the left one is heavier, then steps along the line. After one full sweep, the heaviest robot has bubbled up to the end. Sweep again and again until a whole pass needs no swaps.

๐Ÿ‘€ Compare neighborsโ†’๐Ÿ”„ Swap if left is heavierโ†’โžก๏ธ Step alongโ†’๐Ÿ” Sweep again
Challenge 1 of 4Plan the sweep
1

Plan one sweep

Tap the arm's steps in the order it should do them for one sweep along the belt.

THE BELT ARM'S JOB ยท PICK STEP 1, THEN 2, THEN 3

๐ŸŒŸ What you learned

Come back tomorrow for another advanced visual coding adventure! โœจ