The Train Heist | Think Like A Coder, Ep 4

520,738 views ・ 2019-12-09

TED-Ed


Please double-click on the English subtitles below to play the video.

Translator: Ayan Organization Reviewer: Daban Q Jaff
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
ئەگەر دوگمەکە دابگریت، ئەوا بۆ ماوی ١٠ چرکە "گرێی هێز"ەکە خاو دەبێتەوە.
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
کە ڕاستەوخۆ دەکەوێتە ژێر کرێنەکە.
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
با بڵێن سفر ژمارەی بەشی ئاسەوارەکەیە، و ژمارە یەکیش بەشێکە لە پێش ئاسەوارەکە.
03:09
That means car 10 is under the crane at the start.
39
189592
3690
کەواتە ژمارە ١٠ واتا شەمەندەفەرەکە لە کاتی دەستپێک دەکەوێتە ژێر کرێنەکە.
03:13
When the train moves one car right, car 9 is under the crane.
40
193282
4449
ئەگەر شەمەندەفەرکە یەک بەش بچێتە پێشەوە، ئەوا ژمارە نۆ دەکەوێتە ژێر کرێنەکە.
03:17
So a right arrow can be thought of as “subtract 1.”
41
197731
3810
کەواتە ئاماژە بۆ لای ڕاست واتا یەک بەش دێتە پێشەوە.
03:21
And when the train moves left from there,
42
201541
2270
و ئەگەریش ئاماژە بۆ لای چەپ بوو، دوبارە بەشی دەیەم دەکەوێتە ژێر کرێنەکە،
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
کەواتە ئاماژە بۆ لای چەپ واتا یەک بەش دەگەڕێتەوە.
03:29
Let’s set our train position variable to 10, since that’s where we start.
45
209408
4455
با گۆڕای شوێنی شەمەندەفەرەکە بە ژمارە ١٠ دابنێین لەو شوێنەوەی کە دەست پێ دەکەین.
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
کەواتە هەر کاتێک گۆڕاوەکە بوو بە سفر، ئەوا هێج دەبێت دوگمەکە دابگرێت.
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
٣ بەش بۆ دواوە، یەک بۆ پێشەوە، ٤ بەشی تر بۆ دواوە.
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
بۆ ئەوەی نهێنی تر بدۆزنەوە.
About this website

This site will introduce you to YouTube videos that are useful for learning English. You will see English lessons taught by top-notch teachers from around the world. Double-click on the English subtitles displayed on each video page to play the video from there. The subtitles scroll in sync with the video playback. If you have any comments or requests, please contact us using this contact form.

https://forms.gle/WvT1wiN1qDtmnspy7