The Factory | Think Like A Coder, Ep 9
-
0:32 - 0:37After a harrowing chase,
Ethic, Hedge, and their new ally Lemma -
0:37 - 0:45find themselves
in a cavernous control room. -
0:45 - 0:48Here the last artifact—
the Node of Memory— -
0:48 - 0:53is suspended within a force field
and powering a supercomputer. -
0:53 - 0:57Ethic is about to deactivate the force
field when Lemma stops her. -
0:57 - 1:02She explains, a decade ago,
she was assigned a research task: -
1:02 - 1:07to use the world machine to create
something that would make everyone happy. -
1:07 - 1:12After many failed attempts, Lemma
discovered a compound that, when ingested, -
1:12 - 1:19made people motivated, happy, creative,
loving… in short, their best selves. -
1:19 - 1:21It was rushed into production.
-
1:21 - 1:25Soon, the entire nation’s food supply
came from Huxenborg, -
1:25 - 1:28with the compound mixed in.
-
1:28 - 1:30The first year was paradise.
-
1:30 - 1:32The second, not so much.
-
1:32 - 1:37Side-effects began to emerge: memory-loss,
listlessness, and self-absorption. -
1:37 - 1:40In the third year,
the government dissolved, -
1:40 - 1:44leaving the robots running everything
in a self-sustaining loop. -
1:44 - 1:48By this point things were too far gone
for Lemma to reverse. -
1:48 - 1:51People had become dependent
on the compound, -
1:51 - 1:55and the few who refused it
formed a resistance to try to fix things. -
1:55 - 1:59It took 10 years for Lemma to find a cure.
-
1:59 - 2:02This factory contains everything
she’ll need to make it, -
2:02 - 2:05but the second they take
the Node of Memory, -
2:05 - 2:09the security system will alert the robots,
and they’ll have to run. -
2:09 - 2:14If, instead, they first reconfigure
the factory to manufacture the cure, -
2:14 - 2:16the people can be saved.
-
2:16 - 2:20Lemma has the whole factory redesign
planned out. -
2:20 - 2:23The problem is…
it’s a little hard to read. -
2:23 - 2:26Her schematic shows all the steps
in the manufacturing process -
2:26 - 2:28needed to make the cure.
-
2:28 - 2:32An arrow from “add nitric acid”
to “shake vigorously” -
2:32 - 2:36means that the acid addition
has to happen before shaking. -
2:36 - 2:38If a single step is performed
out of order, -
2:38 - 2:41the cure won’t work, or worse.
-
2:41 - 2:46There aren’t any circular references,
where step A requires step B -
2:46 - 2:50and step B eventually requires step A.
-
3:05 - 3:07Here’s where Ethic and Hedge come in.
-
3:07 - 3:11Lemma needs Hedge to translate
the tangled diagram -
3:11 - 3:13into a sequence of steps.
-
3:13 - 3:16That’ll be the order that things happen
in the factory. -
3:16 - 3:18Once input into the central computer,
-
3:18 - 3:22the factory will reassemble
itself as instructed. -
3:22 - 3:26Hedge’s ability to store information
in a table will help here. -
3:26 - 3:31So how does Ethic program Hedge
to turn out a correct sequence -
3:31 - 3:33that can reconfigure the factory?
-
3:33 - 3:35Pause now to figure it out yourself.
-
3:35 - 3:36Rules in 3
-
3:36 - 3:37Rules in 2
-
3:37 - 3:37Rules in 1
-
3:39 - 3:40Hint in 3
-
3:40 - 3:41Hint in 2
-
3:41 - 3:43Hint in 1
-
3:43 - 3:47It may help to first think about
this problem as a human, -
3:47 - 3:48rather than a machine.
-
3:48 - 3:52Given this diagram, it’s clear to start
with getting a bowl, -
3:52 - 3:55since no arrows point to it.
-
3:55 - 4:00How might you mark up the diagram
to figure out what to do next? -
4:00 - 4:02Pause now to figure it out yourself.
-
4:02 - 4:02Solution in 3
-
4:02 - 4:04Solution in 2
-
4:04 - 4:05Solution in 1
-
4:05 - 4:11Diagrams like the one Lemma has drawn
are called directed acyclic graphs. -
4:11 - 4:15A graph is a representation of data
that shows different elements -
4:15 - 4:17and how they’re related to each other.
-
4:17 - 4:23Directed means that direction matters—
as indicated by the arrows. -
4:23 - 4:27Here A leads to B,
but B doesn’t lead to A. -
4:27 - 4:31And acyclic means that there
aren’t any loops. -
4:31 - 4:36Which is fortunate, because if there were,
this problem wouldn’t be solvable. -
4:36 - 4:40There’s a simple way to navigate
the graph as a human: -
4:40 - 4:43start with a step that doesn’t have
any arrows pointing to it. -
4:43 - 4:48Once you do that, cross out that step
and all arrows leading from it. -
4:48 - 4:52Choose another step with no arrows
pointing to it, -
4:52 - 4:55and repeat until you’ve hit every step.
-
4:55 - 4:59There are two things here that are tricky
to translate for a robot. -
4:59 - 5:02First, how do you keep track
of the information? -
5:02 - 5:07And second, what do you do if there
are multiple options at the same time? -
5:07 - 5:09For the first challenge,
-
5:09 - 5:13a convenient way for machines
to store information is in a table. -
5:13 - 5:17In this case, you can have Hedge
list every step in the headers -
5:17 - 5:20of both the rows and columns.
-
5:20 - 5:23Then he can go through
the rows one at a time. -
5:23 - 5:26On the schematic, what points to mix?
-
5:26 - 5:28Both shake and titrate.
-
5:28 - 5:31So Hedge should make a mark
in both of their columns. -
5:31 - 5:37He can do the same for every row,
one at a time, to make a table like this. -
5:37 - 5:41Of course the full table
will be much bigger. -
5:41 - 5:43Like a human,
Hedge will also want to start -
5:43 - 5:47from one of the steps that has
no arrows pointing to it— -
5:47 - 5:51which is the same as having no marks
in its row. -
5:51 - 5:52If there’s more than one,
-
5:52 - 5:57a convenient way to choose is to pick
the one that’s alphabetically earliest, -
5:57 - 6:01though other selection methods
can work just as well. -
6:01 - 6:05Next, Hedge can add that step
to his running-order list, -
6:05 - 6:07delete its entire column from the table—
-
6:07 - 6:10thus removing all the times
it was a dependency–– -
6:10 - 6:13and loop back to the start.
-
6:13 - 6:16Because there are no circular
references in the graph, -
6:16 - 6:22each time we get here there’ll be at least
one step with no remaining dependencies. -
6:22 - 6:27Hedge can add the alphabetically earliest
to his running-order list, -
6:27 - 6:31remove it from the table,
and loop back to the start again. -
6:31 - 6:33So now we have a working loop,
-
6:33 - 6:38and it’ll run through all the elements
in our table until none are left. -
6:38 - 6:41Hedge drifts back and forth
over the schematics, -
6:41 - 6:44and soon he starts spitting
out instructions, -
6:44 - 6:47which Ethic uses to configure
the assembly lines. -
6:56 - 6:58With the three working together,
-
6:58 - 7:01they churn out thousands of doses
of the cure in no time. -
7:14 - 7:17Ethic finally plucks the Node of Memory
-
7:17 - 7:20from its holding field
and trips the alarm. -
7:20 - 7:23Within seconds bots are everywhere.
-
8:02 - 8:07As Ethic falls in shock, the Node
restores not only her own memories, -
8:07 - 8:11but reveals the last, missing pieces
of the puzzle. -
8:11 - 8:14Ethic built Hedge with a singular purpose:
-
8:14 - 8:18to construct a maze that would protect
the world machine -
8:18 - 8:19from a corrupt government.
-
8:19 - 8:23But in her haste,
she made a critical mistake. -
8:23 - 8:26She forgot to set the condition
that would end the loop -
8:26 - 8:29which told Hedge
how large the maze should be. -
8:29 - 8:34So Hedge built and built
until he could build no longer. -
8:34 - 8:36And then he was conflicted.
-
8:36 - 8:37He had to build a maze.
-
8:37 - 8:41But he couldn’t build further
without hurting people -
8:41 - 8:43or flying over the Bradbarrier,
-
8:43 - 8:45both forbidden by his programming.
-
8:45 - 8:49So he wandered the land
and searched for a solution, -
8:49 - 8:53until he happened upon the Node of Power,
the Node of Creation, -
8:53 - 8:55and the Node of Memory.
-
8:55 - 8:58He recognized their true,
collective power -
8:58 - 9:01to grant self-awareness
to those who lack it. -
9:01 - 9:04With all three he’d be able
to change his programming -
9:04 - 9:09and fulfill his drive to transform
the entire world into a giant maze. -
9:09 - 9:11It wouldn’t be easy:
-
9:11 - 9:15the Nodes had safeguards to prevent
robots from taking and using them. -
9:15 - 9:18But if Hedge could find the right human
-
9:18 - 9:22and manipulate her
with the promise of a heroic quest… -
9:22 - 9:24well that would be a different story.
-
9:24 - 9:27A very different story.
- Title:
- The Factory | Think Like A Coder, Ep 9
- Speaker:
- Alex Rosenthal
- Description:
-
View full lesson: https://ed.ted.com/lessons/the-factory-think-like-a-coder-ep-9
This is episode 9 of our animated series "Think Like A Coder." This 10-episode narrative follows a girl, Ethic, and her robot companion, Hedge, as they attempt to save the world. The two embark on a quest to collect three artifacts and must solve their way through a series of programming puzzles.
Lesson by Alex Rosenthal, directed by Kozmonot Animation Studio.
- Video Language:
- English
- Team:
- closed TED
- Project:
- TED-Ed
- Duration:
- 09:45
lauren mcalpine approved English subtitles for The Factory | Think Like A Coder, Ep 9 | ||
lauren mcalpine accepted English subtitles for The Factory | Think Like A Coder, Ep 9 | ||
lauren mcalpine edited English subtitles for The Factory | Think Like A Coder, Ep 9 | ||
Tara Ahmadinejad edited English subtitles for The Factory | Think Like A Coder, Ep 9 | ||
Tara Ahmadinejad edited English subtitles for The Factory | Think Like A Coder, Ep 9 | ||
Tara Ahmadinejad edited English subtitles for The Factory | Think Like A Coder, Ep 9 |