The Resistance | Think Like A Coder, Ep 2
-
0:22 - 0:25After breaking Ethic out of prison,
-
0:25 - 0:28Hedge flies them both towards
a frontier settlement -
0:28 - 0:35in the shadow of the Bradbarrier,
the great wall that encircles the nation. -
0:35 - 0:39All the settlers there will soon gather
for the monthly feeding. -
0:39 - 0:43The people of the wall spend their days
gathering up works of art and literature, -
0:43 - 0:46from all across the land.
-
0:46 - 0:50On feeding day, the furnace-bots arrive,
ravenous. -
0:50 - 0:56If they eat, the lights stay on,
and the food gets delivered. -
0:56 - 0:59If they starve, the people do too.
-
1:01 - 1:06Hedge’s fuel supply runs out just as he
and Ethic reach the outskirts of town, -
1:06 - 1:09and they come in for a crash landing.
-
1:11 - 1:15Luckily, everyone is too busy preparing
for the feeding to notice. -
1:15 - 1:18Today’s feeding is where Ethic
can find the leader -
1:18 - 1:21of an underground resistance movement.
-
1:21 - 1:25This person knows the location of the
first of three powerful artifacts. -
1:25 - 1:27The problem is, Hedge and
Ethic don’t know -
1:27 - 1:31the resistance leader’s name
or appearance. -
1:31 - 1:35But Hedge has gathered the
following information: -
1:35 - 1:37The leader has green eyes.
-
1:37 - 1:43If the leader has red hair, their name has
at least one consecutive double letter. -
1:43 - 1:48If the leader wear glasses,
their name has exactly 2 vowels. -
1:48 - 1:52Otherwise, their name has
exactly 3 vowels. -
1:52 - 1:57There is exactly one person for whom
these are all true. -
1:57 - 1:58As a fugitive,
-
1:58 - 2:03Ethic can’t sneak into the crowd without
drawing attention to herself. -
2:03 - 2:05But she can give instructions to Hedge.
-
2:05 - 2:10And one tool she has is what
programmers call a conditional. -
2:10 - 2:13That’s a statement of the form
“If A, then B.” -
2:13 - 2:16Flowcharts are great illustrations
of how those work. -
2:16 - 2:22This conditional translates to:
if A is true, carry out instruction B. -
2:22 - 2:26There are also conditionals that account
for different possibilities. -
2:26 - 2:30This says, “If A is true, perform
instruction B. -
2:30 - 2:34Otherwise, carry out instruction C.”
-
2:34 - 2:39So what instructions does she give Hedge
so he can find the resistance leader? -
2:39 - 2:43Pause now to figure it out for yourself.
-
2:43 - 2:47With a problem like this,
it can help to simplify first. -
2:47 - 2:51What if Hedge just has to examine
this one person? -
2:51 - 2:54What information does he need
to collect about her? -
2:54 - 2:57He might ask, “Does she have green eyes?”
-
2:57 - 3:02What other questions should Hedge
ask to find the resistance leader, -
3:02 - 3:06and how can he track those answers?
-
3:06 - 3:11Pause now to figure it out for yourself.
-
3:11 - 3:15It may seem intuitive how you’d approach
this problem as a human. -
3:15 - 3:16But Hedge isn’t a human,
-
3:16 - 3:21and so the challenge comes from needing
to give him systematic instructions -
3:21 - 3:24that will work in any scenario.
-
3:24 - 3:27Hedge needs to examine the settlers,
one at a time, -
3:27 - 3:29until he discovers the right person.
-
3:29 - 3:33In other words, like with the
lock on the prison cell, -
3:33 - 3:37this is a loop that repeats the
same instructions. -
3:37 - 3:40Only this time the loop will involve
a series of questions -
3:40 - 3:42in the form of conditionals,
-
3:42 - 3:45and will end as soon as Hedge
finds his target. -
3:45 - 3:49But first, you’ll want to organize
your information. -
3:49 - 3:55Each person has a set of characteristics:
Eye color, hair color, glasses, and name. -
3:55 - 3:57Does this person have green eyes?
-
3:57 - 4:02If so, mark a check next to “eye color."
If not, mark an X there. -
4:02 - 4:06If they have red hair, does their
name contain a double letter? -
4:06 - 4:10If so, mark a check next to “hair color.”
-
4:10 - 4:14If they don’t have a double letter,
mark an X next to “hair color.” -
4:14 - 4:19Anyone with red hair and no double
letter can’t be the resistance leader. -
4:19 - 4:21But notice that if they have blue hair,
-
4:21 - 4:25Hedge will skip this question and
go on to the next one. -
4:25 - 4:28For the last question, we can say,
-
4:28 - 4:33“If they wear glasses, does their name
have exactly 2 vowels? -
4:33 - 4:38If they don’t have glasses, does their
name have exactly 3 vowels?” -
4:38 - 4:42There will be people in the crowd with
glasses and 1 vowel, -
4:42 - 4:45or no glasses and 2 vowels.
-
4:45 - 4:49But they’re not who we’re looking for,
so they’ll get X’s. -
4:49 - 4:52The resistance leader must be someone
with either check marks -
4:52 - 4:55or blanks next to every question.
-
4:55 - 4:58Blanks are ok, because if someone
has blue hair, -
4:58 - 5:02the rule about red hair doesn’t
apply to them. -
5:02 - 5:06You could have Hedge ask every question
about every person, -
5:06 - 5:09and then choose the person with
only checks and blanks. -
5:09 - 5:14But there’s a way to save yourself lots
of time: as soon as Hedge marks an X, -
5:14 - 5:17have him move on to the next person.
-
5:17 - 5:19You don’t need to know the answer
to every question; -
5:19 - 5:24just one X means they’re not the target
of your search. -
5:26 - 5:28Hedge buzzes through the crowd,
-
5:28 - 5:32and within minutes finds Adila,
the resistance leader, -
5:32 - 5:34and brings her back to Ethic.
-
5:34 - 5:39Adila agrees to help them steal the first
artifact— the node of power— -
5:39 - 5:41but under one condition:
-
5:41 - 5:44that Ethic and Hedge jump-start
the revolution -
5:44 - 5:48by reprogramming the furnace-bots
that terrorize the town. -
5:48 - 5:51And right on cue, the robots descend.
- Title:
- The Resistance | Think Like A Coder, Ep 2
- Speaker:
- Alex Rosenthal
- Description:
-
View full lesson: https://ed.ted.com/lessons/the-resistance-think-like-a-coder-ep-2
This is episode 2 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:
- 05:54
lauren mcalpine edited English subtitles for The Resistance | Think Like A Coder, Ep 2 | ||
Elise Haadsma approved English subtitles for The Resistance | Think Like A Coder, Ep 2 | ||
Elise Haadsma accepted English subtitles for The Resistance | Think Like A Coder, Ep 2 | ||
lauren mcalpine edited English subtitles for The Resistance | Think Like A Coder, Ep 2 |