請雙擊下方英文字幕播放視頻。
譯者: Clement Fu
審譯者: Helen Chang
[TED-Ed 原創系列]
《時代女神 x 程式邏輯革命》
[地點:八達圍]
[第四集:掠過]
00:21
Ethic, Hedge, and Adila, the leader
of the revolution,
0
21570
3790
彥霖、凌杰和光復領袖艾德拉
00:25
plot out how they can steal an artifact
called the Node of Power.
1
25360
5179
從長計議「力量之泉」的神偷妙計
00:30
It’s being used to run a heavily fortified
train that runs all around the country,
2
30539
5557
這枚瑰寶推動穿梭全國的重裝列車
00:36
providing supplies
to settlements and facilities.
3
36096
3730
補給各殖民地及基地設施
00:39
This armored behemoth
4
39826
1628
憚赫千里、龐大無比的裝甲列車
00:41
undergoes a complex and unpredictable
unloading procedure—
5
41454
3988
到站後的卸載程序複雜難測
00:45
a procedure which is displayed, in detail,
on a screen within the engine car.
6
45442
5384
卻在引擎室的螢幕上一清二楚
00:50
Right means the train will go one
car length forward,
7
50826
3560
右箭頭表示列車前行一節車廂
00:54
and left means the train will go the
same distance backwards.
8
54386
4001
左箭頭則是倒退一節車廂
00:58
While unloading, the train frequently
moves back and forth,
9
58387
3842
卸載時,列車經常前後往復
01:02
so a typical sequence
might look like this.
10
62229
4960
流程看起來就是這樣子
01:07
Also within the engine car is a button
that can only be pressed once.
11
67189
5085
引擎室也有只許按下一次的按鈕
01:12
When pressed, it lets down the force
field over the artifact for 10 seconds.
12
72274
5390
按下會解除環繞瑰寶的力場 10 秒
01:17
The engine car is tiny
and designed for a robot.
13
77664
3750
引擎室為機器人設計,非常狹小
01:21
Of your team, only Hedge can fit.
14
81414
3395
三人行,只有凌杰鑽得進去
01:24
The members of the resistance have
positioned a crane over the train tracks
15
84809
3908
光復手足已在鐵路旁架好吊車
01:28
that can pluck the artifact
once it’s exposed.
16
88717
3167
時機一到,就可掠走瑰寶
01:31
They’ll know when to lower
the crane by sight.
17
91884
2995
吊臂該何時降下,可靠目測
01:34
But the only way Hedge can determine
the train’s position
18
94879
3360
另一方面,要判斷列車所在的位置
01:38
and know when to lower
the force field
19
98239
2287
以及該何時解除瑰寶的力場光環
01:40
is by analyzing the unloading procedure,
20
100526
3128
凌杰還得分析卸載程序才知道
01:43
because he’ll be inside
the windowless engine car.
21
103654
3968
因為他將身處四面無窗的引擎室
01:47
Hedge can’t program himself though, so
it’s up to Ethic to tell him what to do.
22
107622
5376
凌杰不會自己寫程式,惟有靠彥霖
01:52
The artifact is in the car
10 positions behind
23
112998
3620
一開始列車到站時,瑰寶那節車廂
01:56
the one that’s directly under the
crane at the start.
24
116618
3163
就在吊車下的車廂往後數第 10 節
01:59
What instructions can Ethic give Hedge
25
119781
2704
彥霖該如何指示凌杰
02:02
so that he hits the button
at just the right moment?
26
122485
3748
於正確時機按下按鈕?
02:13
Here’s a hint to get you started.
27
133506
3550
先給大家一個秘訣
02:17
The key to this problem, as with many
programming challenges,
28
137056
3857
解題關鍵諸如其他程式設計難題
02:20
is to reframe the information in a way
that a computer can work with.
29
140913
4381
是把資訊重組成供電腦處理的框架
02:25
A computer doesn’t know
what a train is, nor does it need to.
30
145294
4620
電腦不知道何謂列車,也毋需知道
02:29
It can, however, work with variables.
31
149914
3110
不過,電腦懂得處理變數
02:33
Try making a variable that tracks
the train’s position.
32
153024
4313
試試拿一個變數來追蹤車廂位置
02:37
How will it change as the train moves?
33
157337
2957
列車挪動時,變數該如何變化?
02:46
Let’s start by breaking this problem
into two objectives.
34
166362
3650
這道題一開始不如拆分成兩個目標
02:50
The first is to know where the train will
be as it carries out its instructions.
35
170012
4873
一是得悉列車按指示挪動時的位置
02:54
The second is to hit the button when
the train is in just the right position.
36
174885
5184
二是當目標車廂到位時就按下按鈕
03:00
For the first objective it’ll help to
think of the train as a big number line.
37
180069
4669
首個目標可視列車為長長的數字線
03:04
Let’s make 0 the car with the node,
1 the car in front of it, and so on.
38
184738
4854
0 是瑰寶所在車廂,前面的是 1
03:09
That means car 10 is under
the crane at the start.
39
189592
3690
如此類推,10 就是吊車下的車廂
03:13
When the train moves one car right,
car 9 is under the crane.
40
193282
4449
列車右挪一下,吊車下就是車廂 9
03:17
So a right arrow can be
thought of as “subtract 1.”
41
197731
3810
右箭頭可想像成「減 1」
03:21
And when the train moves left
from there,
42
201541
2270
當列車左挪一下,吊車下又重回 10
03:23
10 is back under the crane,
43
203811
1840
03:25
making a left arrow the same as “add 1."
44
205651
3757
左箭頭等如「加 1」
03:29
Let’s set our train position variable
to 10, since that’s where we start.
45
209408
4455
車廂位置變數設成 10 即開始位置
03:33
We can now use a loop
to read the instructions one at a time,
46
213863
4330
之後就可用迴圈逐一讀取列車指示
03:38
adding or subtracting as we go,
to track which car is under the crane.
47
218193
5104
每次加一或減一追蹤吊車下的車廂
03:43
The nice thing about setting up
the variable this way
48
223297
2750
這樣設定變數
03:46
is that it tells us how far the node
is from the crane.
49
226047
3316
好讓我們知道吊車與瑰寶的距離
03:49
So as soon as the variable hits 0,
Hedge should hit the button.
50
229363
4064
一俟變數為 0,凌杰就應該按下按鈕
03:53
And here’s what happens.
51
233427
1810
言歸正傳
03:55
Ethic gets into position on the crane
while Hedge rushes off
52
235237
3674
彥霖躍上吊臂待命
03:58
and slips into the engine car unnoticed,
just before the train lurches to life.
53
238911
5898
列車起動時凌杰也剛好竄進引擎室
04:04
It rolls 3 cars back. 1 forward,
another 4 back.
54
244809
4893
之後倒退 3 節、前進 1 節、後退 4 節
04:09
Then so far forward Ethic loses track
before it reverses once more.
55
249702
5819
前進不知幾多節再後退,彥霖儍眼
04:15
When the artifact
finally rolls into position,
56
255521
3021
當瑰寶到位時,艾德拉降下吊臂
04:18
Adila lowers the crane,
hoping Ethic and Hedge got it right.
57
258542
3790
餘下的就交棒彥霖、凌杰
04:22
At the last possible moment,
the force field sputters and falls.
58
262332
4372
千鈞一髮,力場光環熄滅
04:26
Ethic swoops in, and lifts the
Node of Power to freedom.
59
266704
5011
彥霖擒拿力量之泉掠過自由的天空
04:31
When Ethic gives the node
to Hedge for safe keeping,
60
271715
2910
正當彥霖把瑰寶交給凌杰保管
04:34
something incredible happens.
61
274625
2091
不可思議的事情發生了
04:36
The artifact shimmers to life
with a vision of the past:
62
276716
3850
瑰寶熠熠生輝,掠過一幕幕過去
04:40
When the crystal was unearthed,
no one could make the console inside work.
63
280566
4806
剛出土時水晶內的主控台與人絕緣
04:45
The government put out a call
for people to try their luck with it,
64
285372
3250
政府旁求俊彥逐一碰運氣鑿開混沌
04:48
one at a time.
65
288622
1452
化頑石為靈石
04:50
Ethic loved to figure out what made
things tick, so she signed up.
66
290074
4323
彥霖一向好奇事物原理,於是自薦
04:54
Within moments at the console,
something clicked into place,
67
294397
3143
埋首主控台不久,彥霖妙手通竅
04:57
and she created her first robot.
68
297540
2760
創造了她第一個機器人
05:00
The government hired Ethic as
chief robotics engineer on the spot.
69
300300
5014
政府即席羅致她為機器人總工程師
05:05
Within a year her creations ran almost
every aspect of society,
70
305314
4170
不足一年女神的造物幾乎鋪天蓋地
成為社會的中流砥柱,民殷國富
05:09
and the nation and its people thrived,
71
309484
2149
05:11
no longer needing to toil
in the fields and factories.
72
311633
3475
上至廠房下至田野都不用蒼生勞苦
05:21
The vision ends, and Hedge detects
the second artifact in the 198forest,
73
321047
6763
顯現的往事到此為止,凌杰偵測到
第二枚瑰寶就在東南方一九八樹林
05:27
to the southeast.
74
327810
1460
05:29
Luckily, the train is going there next,
75
329270
2336
可幸,列車下一站正駛往那個地方
05:31
and has just enough reserve
fuel for the trip.
76
331606
3034
列車的備用燃料也該熬得過去
05:34
Ethic and Hedge smuggle themselves aboard
77
334640
2557
彥霖、凌杰偷偷躥上列車藏身暗角
05:37
and find a hiding spot
for the long journey ahead.
78
337197
3558
在夜沉沉、路遙遙的旅途邁向黎明
New videos
關於本網站
本網站將向您介紹對學習英語有用的 YouTube 視頻。 您將看到來自世界各地的一流教師教授的英語課程。 雙擊每個視頻頁面上顯示的英文字幕,從那裡播放視頻。 字幕與視頻播放同步滾動。 如果您有任何意見或要求,請使用此聯繫表與我們聯繫。