Microduck Studio books · Book 1 of 4 · Beginner

Meet the Microduck

How a little robot duck senses, thinks, moves and learns. Ten lessons, each with a pop-up to play.

Who it is for: readers 7 and up, with a grown-up. There is no code, and you do not need a robot: paper Duck Cards, Microduck Studio and Kith are enough.

  1. A body, senses and a brain
  2. Do this, then that
  3. Say it shorter
  4. When it falls
  5. Why walking is hard
  6. Learning by trying
  7. A practice world
  8. Pretend is not perfect
  9. Kind company
  10. Your duck, your idea

How a lesson works: read the left page and make a prediction. Then press the steps on the right page, one at a time, and find out if you were right. Each lesson ends with things to try for real, notes for grown-ups, and where every number comes from.

Lesson 1 · The robot

A body, senses and a brain

The Microduck is a little robot duck, a little shorter than a school ruler is long.

It has a body: two legs to walk on, a long neck, and a head with a beak.

It has senses. A sensor inside its body feels which way is down, a bit like the feeling in your tummy on a swing. And every motor can feel how far it has turned.

It has a brain: a program on a tiny computer inside it. The brain reads the senses, decides what to do, and tells the motors to move. Then it does it all again. And again.

Sense, think, move. Then do it again.

Predict

How many times does the duck sense, think and move in one second?

Check your prediction

50 times every second. That is faster than you can blink, so the duck can feel a wobble and fix it before it turns into a fall.

The pop-up

  1. Body. The paper duck stands up: two legs, a body, a neck, and a head with a beak.
  2. Senses. The sensor in its body lights up and points down. Then every motor glows, one after another: each one can feel how far it has turned.
  3. Brain. The brain lights up, and dots carry what the senses felt into it.
  4. Move. The brain sends dots out to the motors, and the duck takes a step.
  5. Again. Sense, think, move, round and round, at the real speed: 50 times every second. Watch the counter.
A paper Microduck: its senses, its brain and its motors, running its loop at the real robot's speed.

Big idea: a robot is a loop. It senses, thinks and moves, then does it all again.

Lesson 2 · Duck Cards

Do this, then that

A robot does what it is told, in the order it is told. Duck Cards are one way to tell it. Each card is one thing the duck can do.

Lay cards in a row and read them from left to right. That row is a program: a plan the duck follows, one card at a time.

On the paper board, one Walk forward card moves the duck one square. One Turn card turns it a quarter turn, on the spot.

One Walk card is one square. One Turn card is a quarter turn.

Predict

The duck is in the bottom left corner, facing up. The pond is one square up and two squares to the right. How many Walk and Turn cards get it there, at the fewest?

Check your prediction

4 cards: Walk forward, Turn right, Walk forward, Walk forward. One card to go up, one to turn, and two to go across. A turn is a card too.

The pop-up

  1. The board. A board of 3 by 3 squares, the duck in the bottom left corner facing up, and a pond.
  2. The cards. Four cards land in a row: Walk forward, Turn right, Walk forward, Walk forward.
  3. Run it. The duck does the cards in order, one at a time: up a square, a quarter turn, then across.
  4. Splash. It ends on the pond, 4 cards later.
The paper board and its rule: one Walk card is one square, one Turn card a quarter turn.

Big idea: a program is a row of steps, done in order. Change the order and the duck goes somewhere else.

Lesson 3 · Loops

Say it shorter

Some programs do the same thing again and again. To walk round a square, the duck walks forward twice and turns, then does that again, and again, and again.

Written out card by card, that is a long row of 12 cards. Long rows are hard to read and easy to get wrong.

A Repeat card says it shorter. Write on it how many times. Put the cards to repeat after it, and close them with End repeat. Everything between the two is a loop.

A loop does the cards inside it again and again.

Predict

How many cards does the short row need, counting the Repeat and End repeat cards?

Check your prediction

5 cards: Repeat 4 times, Walk forward, Walk forward, Turn left, End repeat. The duck walks the very same square with 7 fewer cards.

The pop-up

  1. The long row. Twelve cards in a line: Walk forward, Walk forward, Turn left, four times over.
  2. Run it. The duck walks all the way round the square, one card at a time.
  3. Fold it. The cards that repeat slide together. A Repeat card goes in front, and End repeat goes behind.
  4. Run it again. The duck walks the same square. The counter shows each time round the loop.
The same square walked twice: once from the long row, once from the short one.

Big idea: a loop says "again" for you. Same moves, fewer cards, fewer places for a mistake to hide.

Lesson 4 · Events

When it falls

Walking robots fall. A good program says what to do when that happens.

A "When it falls" card starts a second row. That row waits. It does nothing at all until the duck falls over.

The real Microduck already knows how to get up. Knock it over and it stands itself up again.

A When row waits for something to happen. Then it runs.

Predict

The duck is halfway through its first row when a ball knocks it over. Once it is back on its feet, what does it do?

Check your prediction

It does its "When it falls" row. Once the duck is back on its feet, the second row runs. The rest of the first row does not run. The second row was waiting the whole time, and a fall is the thing it was waiting for.

The pop-up

  1. Two rows. The first row walks. The second row starts with "When it falls", then Alarm and Walk back.
  2. Walk. The duck starts its first row. The second row waits.
  3. Bump. A ball rolls in and knocks the duck over.
  4. Up again. The duck stands itself back up.
  5. Alarm. Now the waiting row runs: the duck sounds the alarm and steps back.
A row that waits for a fall. The getting-up is the duck's own; the second row is ours.

Big idea: a program can wait for something to happen, and already know what to do when it does.

Lesson 5 · Balance

Why walking is hard

Stand on one foot. Feel the wobble? You are balancing.

Every body has a middle point, where all its weight seems to sit. It is called the center of mass. To stay up, that point has to stay above your feet.

The duck's head is heavy: more than a third of the whole duck. When its head swings, its middle point moves, and the duck has to keep it over its feet.

Walking is even harder. A walking body moves its middle point ahead of its feet on purpose, starts to fall, and catches itself with the next step. Over and over.

Keep your middle point over your feet.

Predict

The duck leans forward more and more. When does it tip over?

Check your prediction

When its middle point passes its toes. Leaning is fine while the middle point is still over the feet. Past the toes, nothing is holding it up.

The pop-up

  1. Middle point. A dot appears where the duck's weight sits, with a string hanging straight down from it.
  2. Feet. The ground under its feet glows. That is where the string has to land.
  3. Lean. The duck leans slowly forward, and the string slides toward its toes.
  4. Tip. The string passes the toes, and the duck tips over.
  5. Catch it. Up again. This time, as it leans, it steps forward and lands its foot under the string. That is a step.
Drag the lean slider to tip the duck yourself. A step is a fall that gets caught.

Big idea: walking is falling forward and catching yourself, again and again.

Lesson 6 · Learning

Learning by trying

How did you learn to ride a bike? Nobody could tell you exactly what to do with every muscle. You tried, you wobbled, and slowly your body worked it out.

Robots can learn like that too. It is called reinforcement learning. The robot tries something. When it goes well, it gets points, called a reward. After many, many tries, it does more of whatever earned points.

Nobody tells it how. It finds out.

Try. Get points for good tries. Do more of what worked.

Predict

A duck in a little maze gets a point each time it reaches the pond. At first it wanders about. After many tries, what does it do?

Check your prediction

It finds the short way to the pond. Its first lucky path wandered, but every try that reached the pond left a little trail of "this was good". After enough tries, the trail leads straight there.

The pop-up

  1. Try. The duck wanders the maze, bumping into walls, until by luck it finds the pond and gets a point.
  2. Remember. The squares it crossed just before the pond glow: good places to be.
  3. Many tries. Try after try, the glow spreads back toward the start.
  4. Learned. Arrows appear on the squares, and the duck walks the short way to the pond.
A toy maze. The real duck learns to walk the same way, with far more tries and far more to learn.

Big idea: points for good tries, and lots of practice, turn wandering into knowing the way.

Lesson 7 · Simulation

A practice world

Learning by trying takes an enormous number of tries, and an enormous number of falls. A real duck would wear out.

So the Microduck practises in a pretend world inside a computer, called a simulation. There, falling does not hurt anything, and the pretend duck can be reset in a blink.

Better still, the computer can run 4,096 pretend ducks.

A fast computer can teach the pretend ducks a walk that works in about 1 to 2 hours.

Practise in pretend first, with lots of ducks at once.

Predict

Why practise with 4,096 ducks instead of just one?

Check your prediction

So one brain learns from all of them. All 4,096 ducks try at the same time. Every one of them tries, falls and learns, and all of them share one brain. That brain learns from all their tries at once, so it gets its practice thousands of times faster.

The pop-up

  1. One duck. A pretend duck tries to walk, wobbles and falls. Reset, and it tries again.
  2. Copies. The page fills with pretend ducks: 4,096 of them.
  3. All at once. They all try at the same moment. Some fall, some get a few steps.
  4. Gather. Everything they tried flows into the one brain they share.
  5. Learned. Practice after practice, the whole crowd walks.
Real numbers: 4,096 pretend ducks, and about 1 to 2 hours on a graphics chip for a walk that works.

Big idea: many pretend ducks practising at once learn fast, and nobody gets hurt.

Lesson 8 · Sim to real

Pretend is not perfect

The pretend world is close to the real one, but it is not the same. A real floor can be more slippery. A real battery gets tired. Every real motor is a tiny bit different from the next.

So while the ducks practise, the pretend world is shaken up on purpose. Some ducks get slippery floors and some get grippy ones. Every duck gets a little push now and then. A duck that learned on all of them is ready for a floor it has never met.

Practise on many different pretend worlds, so the real one is just one more.

Predict

A duck that practised in the pretend world walks a row of 4 Walk cards on a floor it has never met. Each card is meant to go one square. Where does it end up?

Check your prediction

Near the fourth square, a little off. Even after all that practice, a real duck slowly wanders off its path. Each step goes a little wrong, and the error grows the longer it walks. The longer the row, the farther off it ends. For now, a Walk card on a real duck is timed: it walks for two seconds, and it does not land exactly on a square.

The pop-up

  1. Pretend. In the world it practised in, the duck walks 4 squares and lands exactly on the last one.
  2. New floor. On a floor it never practised on, each step goes a little wrong, and the errors add up as it walks.
  3. Shake it up. In practice, the floors change: slippery, grippy, a push from the side.
  4. Ready. A duck that practised on every kind of floor copes better with a new one.
A toy picture of drift: the size of each miss here is made up. Real misses depend on the floor, the duck and its battery.

Big idea: a robot that practised in many slightly wrong worlds copes with the real one.

Lesson 9 · Living with people

Kind company

A robot that lives with people needs more than legs. It needs good manners.

Kith is a game you play in a web browser, made by the same person as this site. You walk with Microducks through a paper valley, or along a real park path. In Kith's park, the ducks keep the real robot's pace, as measured in simulation. It is slow: about as fast as a very old dog. A good friend slows down to walk with you.

Good manners are skills too, and the duck can practise them.

Keep pace, and wait for each other.

Predict

The duck comes to steps it cannot climb. What is the clever, kind thing for it to do?

Check your prediction

Stop and ask for help. In Kith the duck stops and asks with a quack. The person lifts it over the steps and sets it down, and they carry on together. Waiting, asking and helping are all skills the duck can practise: keep pace, wait, ask for help, and help back.

The pop-up

  1. Together. A person and a duck walk side by side, at the duck's pace.
  2. Too fast. The person hurries ahead. The gap grows, and the duck cannot keep up.
  3. Wait. The person stops and waits. They walk on together.
  4. Steps. The duck reaches steps it cannot climb. It stops and asks.
  5. On they go. The person lifts the duck over the steps and sets it down, and they walk on together.
A walk in Kith, sped up. Measured in simulation, on the level, the real robot walks about 0.12 metres a second, about the length of your hand each second.

Big idea: good company is a skill: match the pace, wait, ask, help.

Lesson 10 · Making

Your duck, your idea

The best Duck Cards are the ones you invent. The deck comes with blank cards, for moves you make up. Each one has its own little square code.

To make a move, pose the duck a few times. Each pose is a keyframe: where every joint should be, and when. The duck moves smoothly from one keyframe to the next.

Every joint has a limit, like your elbow. A good move stays inside the limits. Microduck Studio checks every angle in a move against the real duck's joints.

A move is poses in time, inside the joints' limits.

Predict

You try to tip the duck's head sideways much farther than it can go. What happens?

Check your prediction

The head stops at its limit. The duck's head can tip about 20 degrees each way. Studio checks every angle in a move against the robot's joints, so it never asks for more. The robot's own software only catches broken orders, so staying inside the limits is the move's job.

The pop-up

  1. Pose one. The duck lifts its head. Click: a keyframe drops onto the timeline.
  2. Pose two. The duck bows. Click: a second keyframe.
  3. Play. The duck moves smoothly from one pose to the other and back.
  4. Too far. Ask the head to tip past its limit. The joint stops at the edge and glows red.
  5. Name it. A blank card gets the move's name: Bow.
Drag the head-tip slider past the limit to see what the joint does.

Big idea: you can invent a move: poses in time, inside the limits. Then give it a card.

Next: Book 2, How a Microduck Learns, opens the duck's brain: what it senses as numbers, what it does, and how 4,096 pretend ducks train it. All four books are on the shelf.