Loop chapter opener illustration

Loop

LOOP — *read. decide. act. repeat. that's the whole robot brain.*

Listen along — Loop

Loading audio…

Press play to listen along. The line being read lights up as you go.

Show full transcript

Loading transcript…

Chapter 4 — Loop and the Read-Decide-Act-Repeat

Loop wasn’t large, but they moved with the focused energy of a tightly wound spring. Their workshop vest, a chunky, practical thing, was covered in faint grease smudges and tiny embroidered gears. Loop’s skin, a soft amber striped with circuit-green, seemed to hum with quiet intensity. They always carried a small, laminated loop-card and a worn cycle-tracker, tools for diagramming the most fundamental concept in robotics: the Read-Decide-Act-Repeat cycle.

“It’s the whole robot brain,” Loop would say, holding up the loop-card. “Every single one, from the simplest toy to the most complex factory arm. Read. Decide. Act. Repeat.”

This wasn’t just a catchy phrase for Loop; it was the core of their craft. Loop taught the primitive of iteration and sensor-driven control – the deep understanding that a robot’s “intelligence” isn’t some mysterious spark, but simply the brain as a loop. It’s a continuous cycle: the robot reads its environment through sensors, decides what to do based on those readings, acts by moving its motors, and then immediately repeats the entire process. This loop runs incredibly fast, often hundreds or even thousands of times per second. Loop’s job was to show kids that the entire program for a robot is structurally a loop, not a one-time script. The real “intelligence” lives in the Decide phase, where the program uses the sensor data to choose its next actions. The Read and Act parts are mechanical, but Decide is where the thinking happens.

“I am Loop,” they’d announce, their voice steady and clear. “The primitive I teach is iteration and control loops. The move is read. decide. act. repeat. that’s the whole robot brain.”

Today, the workshop hummed with a different kind of anticipation. A small, wheeled robot sat at the entrance of a miniature maze, its ultrasonic sensors like two wide, unblinking eyes. Drive, whose motors were already tuned and ready for action, leaned forward, eager. Sense, who had carefully mounted the ultrasonics, adjusted a tiny wire. Servo, their mentor, watched from a workbench, a faint smile playing on their lips.

Loop stepped to the whiteboard, picking up a marker. “Alright, team,” they said, drawing a large circle. “This is our robot’s brain. And it’s a loop. A very fast, very simple loop.” They divided the circle into four sections.

“Step 1,” Loop began, writing ‘READ’ at the top. “What does our maze-solving robot need to know about the world?”

Sense piped up immediately. “If there’s a wall in front of it! And how far away it is!”

“Exactly,” Loop nodded, adding, “READ ultrasonic sensors. Get distance to nearest wall.” They tapped the robot’s sensors. “These are its eyes, telling it about the world.”

Next, Loop moved to the right side of the circle, writing ‘DECIDE’. “Now, based on what it reads, what does the robot need to decide?”

Drive, always thinking about movement, offered, “If it can go straight, it should go straight! Fast!”

“Good,” Loop affirmed, writing. “If no wall, full speed ahead.” They paused, looking at the maze. “But what if there is a wall?”

A younger student, Maya, who usually preferred coding games, ventured, “It needs to turn?”

“Yes, but which way?” Loop prompted. “Left or right? How does it decide?”

Sense frowned. “It can’t see around the corner yet. It only knows what’s in front.”

“That’s the trick,” Loop explained. “The robot has to make a decision with limited information. So, if a wall is in front, it slows down. Then, it might briefly turn a little left, read again. Then turn a little right, read again. It’s making tiny, quick decisions based on new readings. So, our Decide step gets a bit more complex: ‘If wall in front, slow down and check left and right. If left has more space, plan to turn left. If right has more space, plan to turn right.’” Loop wrote this out, the words filling the section. “This is where the ‘intelligence’ really lives. It’s not magic; it’s just a set of rules, an ‘if-this-then-that’ logic tree, applied to the sensor data.”

“Then what?” Maya asked, eyes wide.

Loop moved to the bottom of the circle, writing ‘ACT’. “Once it’s decided, it has to act. What does that mean for our robot?”

“Motors!” Drive exclaimed. “Send commands to the motors to turn or go straight!”

“Precisely,” Loop said, writing: “Send motor commands matching the decision.”

Finally, Loop completed the circle, drawing an arrow from ‘ACT’ back to ‘READ’ and writing ‘REPEAT’ on the left side. “And then, the most important part: REPEAT. Go back to Step 1. This loop runs about 30 times per second. Every single cycle, the robot re-checks the world, re-decides, and re-adjusts its actions. It’s constantly taking in new information and reacting.”

The cast nodded, a few murmuring “thirty times a second?” in disbelief. It was like the ‘while loops’ they’d learned in CodeForge, but happening so fast you couldn’t even see the individual steps. It was also a bit like how their own brains worked, how their attention quickly scanned for new information, made a tiny decision, and then acted, only to immediately scan again—a fast loop of human attention, just like they’d discussed in MindForge.

“There’s no magic,” Loop emphasized, tapping the ‘DECIDE’ section. “No mysterious ‘robot brain’ thinking deep thoughts. Just this loop, running incredibly fast, combining simple decisions into what looks like complex behavior.”

Servo gave a signal. “Ready to run the program?”

Drive and Sense gave thumbs up. The robot whirred to life. It rolled forward, slowly at first, its sensors scanning. It approached a wall, slowed, then seemed to hesitate. A tiny, almost imperceptible wiggle, a quick read-decide-act for left, then for right, and then it smoothly pivoted left, finding the open path. It sped up, then slowed again for the next turn, repeating the process. It wasn’t perfect; sometimes it bumped gently, or took a slightly wider turn than necessary, but it consistently moved through the maze, adjusting its path with each new reading. It was making decisions under uncertainty, much like the probability trees they’d explored in ChanceForge.

The robot reached the end of the maze. The kids cheered.

Servo walked over, a genuine smile now. “Read. Decide. Act. Repeat. That’s it. Loop captures the whole loop.”

It was a powerful demonstration. The robot hadn’t been programmed with a map of the maze, or told exactly when to turn. Its “intelligence” came from those four simple steps, cycling endlessly, adapting to whatever its sensors told it. It demystified the idea of robotics and automation, showing it not as some magical black box, but as fast-running loops that combined simple decisions into seemingly complex behavior. And in that understanding, the wonder didn’t disappear; it grew, like seeing the intricate gears of a clock and appreciating its genius even more.


The RoboForge ensemble

Loop is part of RoboForge's distributed-narrative cast. Each character embodies a different curricular primitive; together they teach the full subject.