The Resistance | Think Like A Coder, Ep 2

774,927 views ・ 2019-10-14

TED-Ed


請雙擊下方英文字幕播放視頻。

譯者: Clement Fu 審譯者: Helen Chang
[TED-Ed 原創系列]
《時代女神 x 程式邏輯革命》
[上回地點:監獄]
[今回地點:八達圍]
[第二集:光復]
00:22
After breaking Ethic out of prison,
0
22038
2568
承上回,彥霖從牢獄逃出生天後
00:24
Hedge flies them both towards a frontier settlement
1
24606
3215
凌杰帶挈她一同飛往前線殖民地
00:27
in the shadow of the Bradbarrier, the great wall that encircles the nation.
2
27821
6820
闖進八達圍這國邦圍牆下的陰霾
00:34
All the settlers there will soon gather for the monthly feeding.
3
34641
4332
殖民地住民將集結迎接每月炊事日
00:38
The people of the wall spend their days gathering up works of art and literature,
4
38973
4215
城牆下的人終日搜刮人文藝術作品
燒得旺的柴,才換來吃得飽的米
00:43
from all across the land.
5
43188
2600
00:45
On feeding day, the furnace-bots arrive, ravenous.
6
45788
4590
炊事日,熔爐機器人如狼似虎到來
00:50
If they eat, the lights stay on, and the food gets delivered.
7
50378
5741
機器人爐火中燒飽足,燈火才通明
廩食才發給人果腹,不然玉石俱焚
00:56
If they starve, the people do too.
8
56119
3290
01:00
Hedge’s fuel supply runs out just as he and Ethic reach the outskirts of town,
9
60954
4980
來到城市邊陲,凌杰剛好燃料耗盡
01:05
and they come in for a crash landing.
10
65934
2798
逼不得已來個硬著陸
01:10
Luckily, everyone is too busy preparing for the feeding to notice.
11
70576
4420
可幸人人為著炊事日鋪張,不以為意
01:14
Today’s feeding is where Ethic can find the leader
12
74996
2874
今天的炊事日,彥霖可趁機找出
01:17
of an underground resistance movement.
13
77870
2681
地下光復運動的領袖,這個人知道
01:20
This person knows the location of the first of three powerful artifacts.
14
80551
4268
三枚強大瑰寶中首枚的收藏地
01:24
The problem is, Hedge and Ethic don’t know
15
84819
2403
問題是,凌杰和彥霖都不知道
01:27
the resistance leader’s name or appearance.
16
87222
3396
光復領袖的名字或樣貌
01:30
But Hedge has gathered the following information:
17
90618
4183
不過凌杰收集到以下情報:
01:34
The leader has green eyes.
18
94801
2415
領袖有綠眼睛
01:37
If the leader has red hair, their name has at least one consecutive double letter.
19
97216
6020
領袖是紅頭髮的話,名字有疊字母
01:43
If the leader wear glasses, their name has exactly 2 vowels.
20
103236
5050
領袖戴眼鏡的話,名字恰好雙母音
01:48
Otherwise, their name has exactly 3 vowels.
21
108286
4013
否則,名字恰好三母音
01:52
There is exactly one person for whom these are all true.
22
112299
4810
上述條件全都吻合的,就只有一人
01:57
As a fugitive,
23
117109
1215
身為逃犯
01:58
Ethic can’t sneak into the crowd without drawing attention to herself.
24
118324
4190
彥霖無法潛入人群而不引入注意
02:02
But she can give instructions to Hedge.
25
122514
2812
不過她可發給凌杰指示,運用她
02:05
And one tool she has is what programmers call a conditional.
26
125326
4179
一件武器:程式員口中的條件式
02:09
That’s a statement of the form “If A, then B.”
27
129505
3680
陳述的形式為:如果甲,則乙
02:13
Flowcharts are great illustrations of how those work.
28
133185
3191
運作原理可在流程圖中活靈活現
02:16
This conditional translates to: if A is true, carry out instruction B.
29
136376
5890
闡釋:條件甲真確,則執行指示乙
02:22
There are also conditionals that account for different possibilities.
30
142266
3912
有些條件式也囊括不同狀況
02:26
This says, “If A is true, perform instruction B.
31
146178
3847
比如說:若甲真確,則執行指示乙
02:30
Otherwise, carry out instruction C.”
32
150025
3693
不然,就執行指示丙
02:33
So what instructions does she give Hedge so he can find the resistance leader?
33
153718
5110
凌杰要甚麼指示才找出光復領袖?
02:38
Pause now to figure it out for yourself.
34
158828
4664
[動腦筋就按暫停,倒數三下給秘訣]
02:43
With a problem like this, it can help to simplify first.
35
163492
3915
先簡化一下,有助解答如此問題
02:47
What if Hedge just has to examine this one person?
36
167407
3580
假如凌杰只消詢問一個人
02:50
What information does he need to collect about her?
37
170987
3245
需要蒐集這個人甚麼資料?
02:54
He might ask, “Does she have green eyes?”
38
174232
3004
也許問:「眼睛瞳孔是綠色嗎?」
02:57
What other questions should Hedge ask to find the resistance leader,
39
177236
4452
還需問甚麼問題才找到光復領袖?
03:01
and how can he track those answers?
40
181688
4040
答案得來又何以疏理?
03:05
Pause now to figure it out for yourself.
41
185728
4990
[動腦筋就按暫停,倒數三下揭謎底]
03:10
It may seem intuitive how you’d approach this problem as a human.
42
190718
3889
依你看來,答這道題也許順理成章
03:14
But Hedge isn’t a human,
43
194607
1773
奈何凌杰畢竟是機器人,挑戰在於
03:16
and so the challenge comes from needing to give him systematic instructions
44
196380
4610
要給他有條不紊的系統指示
03:20
that will work in any scenario.
45
200990
2664
任何狀況皆滴水不漏
03:23
Hedge needs to examine the settlers, one at a time,
46
203654
2924
凌杰需要逐一詢問殖民地住民
03:26
until he discovers the right person.
47
206578
2561
直至找到對的人
03:29
In other words, like with the lock on the prison cell,
48
209139
3570
換言之,就像上回破解監獄枷鎖
03:32
this is a loop that repeats the same instructions.
49
212709
3846
這是一個重複相同指示的迴圈
03:36
Only this time the loop will involve a series of questions
50
216555
3528
只是這次迴圈加入一系列
以條件式呈現的問題
03:40
in the form of conditionals,
51
220083
1687
03:41
and will end as soon as Hedge finds his target.
52
221770
3311
一俟凌杰找到目標,迴圈便告終
03:45
But first, you’ll want to organize your information.
53
225081
3511
在此之前,先整理一下收集的情報
03:48
Each person has a set of characteristics: Eye color, hair color, glasses, and name.
54
228592
6538
每人有一組合特徵:眼睛色、 髮色、是否戴眼鏡、名字
03:55
Does this person have green eyes?
55
235130
2167
這個人有綠眼睛嗎?
03:57
If so, mark a check next to “eye color." If not, mark an X there.
56
237297
5070
是的,眼睛色一欄打勾,不然打叉
04:02
If they have red hair, does their name contain a double letter?
57
242367
3840
紅頭髮的話,名字有疊字母嗎?
04:06
If so, mark a check next to “hair color.”
58
246207
3336
有的,就在髮色一欄打勾
04:09
If they don’t have a double letter, mark an X next to “hair color.”
59
249543
4289
沒有疊字的,就在髮色一欄打叉
04:13
Anyone with red hair and no double letter can’t be the resistance leader.
60
253832
4750
紅頭髮卻沒有疊字母的不會是領袖
04:18
But notice that if they have blue hair,
61
258582
2250
注意若是藍頭髮
04:20
Hedge will skip this question and go on to the next one.
62
260832
4600
凌杰就會跳過此題問下一題
04:25
For the last question, we can say,
63
265432
2369
最後一題可以問:
04:27
“If they wear glasses, does their name have exactly 2 vowels?
64
267801
4750
戴眼鏡的話,名字是否恰好雙母音?
04:32
If they don’t have glasses, does their name have exactly 3 vowels?”
65
272551
5578
沒戴眼鏡的,名字是否恰好三母音?
04:38
There will be people in the crowd with glasses and 1 vowel,
66
278129
4328
人群中總有人戴眼鏡、名字單母音
04:42
or no glasses and 2 vowels.
67
282457
2407
或不戴眼鏡、名字雙母音
04:44
But they’re not who we’re looking for, so they’ll get X’s.
68
284864
3809
兩者均不是要找的人,可以打叉
04:48
The resistance leader must be someone with either check marks
69
288673
3525
各題答案要嘛打勾要嘛留空
04:52
or blanks next to every question.
70
292198
2829
才是光復領袖
04:55
Blanks are ok, because if someone has blue hair,
71
295027
3086
留空是可以的,比方說藍頭髮的人
04:58
the rule about red hair doesn’t apply to them.
72
298113
3810
紅頭髮那道法則就不適用
05:01
You could have Hedge ask every question about every person,
73
301923
3588
凌杰大可逢人問盡每道題
05:05
and then choose the person with only checks and blanks.
74
305511
3704
然後挑出只打勾或留空的人
05:09
But there’s a way to save yourself lots of time: as soon as Hedge marks an X,
75
309215
4950
然而事半功倍的做法是
一打叉就下一位
05:14
have him move on to the next person.
76
314167
2555
05:16
You don’t need to know the answer to every question;
77
316722
2572
不必悉數知道各題答案
05:19
just one X means they’re not the target of your search.
78
319294
5110
一打叉就足見這不是要找的人
05:26
Hedge buzzes through the crowd,
79
326283
1802
凌杰穿梭於人群中
05:28
and within minutes finds Adila, the resistance leader,
80
328085
3561
不消數分鐘就找到光復領袖艾德拉
05:31
and brings her back to Ethic.
81
331646
2139
引到彥霖面前
05:33
Adila agrees to help them steal the first artifact— the node of power—
82
333785
5270
艾德拉應允襄助重奪第一枚瑰寶:
力量之泉;惟有一個條件
05:39
but under one condition:
83
339055
1963
05:41
that Ethic and Hedge jump-start the revolution
84
341018
2728
彥霖凌杰得馬上起革命,率先改造
05:43
by reprogramming the furnace-bots that terrorize the town.
85
343746
4603
肆虐全城的熔爐機器人身上的程式
05:48
And right on cue, the robots descend.
86
348349
2780
話畢,機器人從天而降
關於本網站

本網站將向您介紹對學習英語有用的 YouTube 視頻。 您將看到來自世界各地的一流教師教授的英語課程。 雙擊每個視頻頁面上顯示的英文字幕,從那裡播放視頻。 字幕與視頻播放同步滾動。 如果您有任何意見或要求,請使用此聯繫表與我們聯繫。

https://forms.gle/WvT1wiN1qDtmnspy7