The Gauntlet | Think Like A Coder, Ep 8

392,598 views ・ 2020-04-16

TED-Ed


아래 영문자막을 더블클릭하시면 영상이 재생됩니다.

번역: Yeonsun Yang 검토: DK Kim
00:21
Their fall from the tower sends Ethic and Hedge
0
21734
3050
타워에서 떨어진 에틱과 헤지는
00:24
spinning into the rapids of a river of pure energy.
1
24784
4240
순수 에너지 강을 빙빙 돌면서 떠내려 갑니다.
00:30
This torrent flows from the Bradbarrier all the way to Huxenborg.
2
30944
5937
이 급류는 브래드 장벽에서 학센보그까지 흘러갑니다.
00:36
There an entire city’s worth of factories
3
36881
3100
그곳은 마을 전체만한 공장으로
00:39
build the robots and house the Node of Memory,
4
39981
3080
로봇을 만들고 기억 노드를 보관하고 있습니다.
00:43
the last of the three powerful artifacts Ethic needs to collect.
5
43061
4372
에틱이 모아야 할 세 가지 상징 중 마지막이지요.
00:47
After a long day and a longer night
6
47433
2510
긴 하루 밤낮이 지난 후
00:49
they find themselves in a canyon of brick and steel.
7
49943
3720
벽돌과 강철로 된 협곡에 이르렀습니다.
00:58
Just when they’re about to reach the end of the line,
8
58918
2655
바닥으로 떨어지기 직전에
01:01
a rope catches them.
9
61573
1750
밧줄이 날아와 이 둘을 끌어냈습니다.
01:07
Their savior, Lemma, has been waiting for them.
10
67023
4114
구세주인 렘마가 기다리고 있었지요.
01:11
When Ethic claimed the Node of Creation from the forest tower,
11
71137
3952
에틱이 숲 탑에서 창조 노드를 얻었을 때
01:15
radios all across the land came back to life.
12
75089
3900
전 지역의 무선이 다시 살아났고
01:18
Adila, the resistance leader, immediately started contacting her allies,
13
78989
4776
저항 운동 지도자인 아딜라는 즉시 동맹에게 연락했지요.
01:23
none more important than Lemma,
14
83765
2610
렘마는 아주 중요한 인물인데
01:26
a brilliant scientist working from within Huxenborg to bring down the machines.
15
86375
5893
뛰어난 과학자로서 기계를 무찌르기 위해 학센보그 내부에서 싸우고 있습니다.
01:32
Unfortunately, the radios also tipped off the robots.
16
92268
4000
안타깝게도 무선 정보는 로봇에게도 누설되었습니다.
01:36
So they’ve taken defensive measures
17
96268
2260
그들은 방어 태세에 들어갔는데
01:38
to protect the final artifact in its home in the very heart of the city.
18
98528
4828
도시 한가운데에 있는 마지막 상징을 지키기 위해서입니다.
01:43
There’s only one way to get there: the gauntlet of forking paths.
19
103356
5155
그곳에 가는 방법은 한 가지뿐으로 첩첩한 갈림길입니다.
01:48
It’s a deadly series of luminous conveyors that wind underneath Huxenborg.
20
108511
6386
학센보그 지하에 뻗어있는 빛이 나는 치명적인 컨베이어로
01:54
Starting from the current position,
21
114897
1820
현재 위치에서 시작해서
01:56
each section runs for a distance, then splits in two.
22
116717
4395
각각은 일정 간격을 두고 두 갈래로 나누어집니다.
02:01
Every branch does the same thing, again and again.
23
121112
3430
모든 분기점에서 반복하여 같은 일이 일어납니다.
02:04
There are thousands of branches.
24
124542
2400
수천 개의 가지가 있는데
02:06
Only one path leads to the artifact; all the others to destruction.
25
126942
5942
한 가지만이 상징으로 이어지고 다른 가지들로 가면 파괴됩니다.
02:12
Fortunately, the Node of Creation has granted Hedge a strange power:
26
132884
4619
다행히 헤지는 창조 노드로부터 이상한 힘을 얻었는데
02:17
he can produce slightly smaller versions of himself.
27
137503
3720
조금 작은 크기로 자신을 복제할 수 있게 됐죠.
02:21
Each version can do only two things: radio information back to its parent,
28
141223
5210
복제품은 단 두 가지 능력이 있는데 원본에 무선 정보를 전파하고
02:26
and produce slightly smaller versions of itself…
29
146433
3740
조금 더 작은 자신을 만들어 냅니다.
02:30
which can do the same two things, as can their children,
30
150173
3690
그 복제품도 그 두 가지를 할 수 있고
02:33
for as many generations as needed.
31
153863
2940
필요한 만큼 계속 만들 수 있지요.
02:36
A patrol is closing in on their position, so Ethic’s time is limited.
32
156803
5051
순찰대가 점점 다가오고 있어서 에틱은 시간이 많지 않습니다.
02:41
What instructions should she give Hedge to find the one safe path?
33
161854
5203
헤지에게 어떤 지시를 내려야 그 안전한 길을 찾을 수 있을까요?
02:47
Pause the video to figure it out yourself.
34
167057
6778
영상을 잠시 멈추고 직접 찾아보세요.
02:53
Hint in 3
35
173835
990
힌트 3초 전
02:54
Hint in 2
36
174825
1200
힌트 2초 전
02:56
Hint in 1
37
176025
960
힌트 1초 전
02:57
Programmers have an elegant tool in their arsenal called recursion.
38
177825
5162
프로그래머는 무기고에 재귀라는 멋진 장비가 있습니다.
03:02
Recursion is when you have a set of instructions that refers back to itself.
39
182987
5341
재귀는 자신한테 다시 돌아가는 일련의 지시가 있을 때 발생합니다.
03:08
It’s like using a word in its own definition,
40
188328
2960
단어를 정의하면서 그 단어를 사용하는 것으로 볼 수 있는데
03:11
except where that’s frowned upon, this is incredibly effective.
41
191288
4560
사용이 금지된 곳을 제외하고는 매우 효과적이죠.
03:15
Recursion involves repetition, but in a different way than loops.
42
195848
4512
재귀는 반복을 하지만 순환과는 다른 방식입니다.
03:20
Where a loop takes one action and repeats it again and again,
43
200360
4000
순환은 한 가지 동작을 마치고 그 동작을 반복하지만
03:24
recursion will start an action, and before it’s finished, use it again,
44
204360
4302
재귀는 한 동작이 끝나기 전에 그 동작을 반복합니다.
03:28
and before that’s finished, use it again, and so on.
45
208662
4000
그리고 그 동작이 끝나기 전에 다시 그 동작을 반복하죠.
03:32
It keeps doing this until some end state is reached.
46
212662
4000
어떤 결말 조건에 이를 때까지 멈추지 않습니다.
03:36
It then passes the information back up, layer after layer,
47
216662
4162
저장한 정보를 층층이 전달하는데
03:40
until it reaches the top and ends the cycle.
48
220824
3620
가장 위에 이르면 동작을 마칩니다.
03:44
Recursion is ideal for problems that involve self-similarity,
49
224444
4662
재귀는 각 부분이 더 큰 전체를 닮는
03:49
where each part resembles the larger whole.
50
229106
2860
자기 유사성 같은 문제에 적합합니다.
03:51
Like, for example, a deadly defense system designed to end any person or thing
51
231966
6004
예를 들어, 치명적인 방어 체계처럼 유해한 사람이나 사물이
03:57
who dares tread upon it.
52
237970
1890
침범했을 때 대처하도록 설계된 것에 말이죠.
03:59
Pause the video to figure it out yourself.
53
239860
2060
영상을 잠시 멈추고 직접 해결해 보세요.
04:01
Solution in 3
54
241920
793
해법 3초 전
04:02
Solution in 2
55
242713
920
해법 2초 전
04:03
Solution in 1
56
243633
1080
해법 1초 전
04:04
Ethic’s conundrum seems sprawling on the surface,
57
244993
3041
에틱의 난문제는 보기에 마구 퍼져 있는 것 같지만
04:08
but there’s a remarkably simple solution to it using recursion.
58
248034
4366
재귀를 이용하면 아주 쉽게 해결할 수 있습니다.
04:12
In order to find it, let’s first look at the simplest version of this puzzle:
59
252400
4750
먼저 이 퍼즐을 가장 간단한 형태로 바꿔서 살펴보죠.
04:17
what if the entire maze were just two paths?
60
257150
3270
만약에 미로 전체가 두 경로뿐이라면 어떻게 될까요?
04:20
If Hedge copies himself, the copy that goes the wrong way will be destroyed.
61
260420
4618
헤지가 복제한 복제품이 틀린 경로로 간다면 파괴되겠죠.
04:25
So the other one, which will reach the artifact,
62
265038
2719
다른 복제품은 상징에 도달할 것이고
04:27
can radio back the path it took, and then no matter which way is correct,
63
267757
4700
어느 경로가 맞든지 무선 정보를 보내서
04:32
that’s the answer Hedge will receive.
64
272457
2401
헤지가 답을 얻을 수 있어요.
04:34
This is called the "base case" of the recursion.
65
274858
3580
이것을 재귀의 '기저 조건'이라고 부릅니다.
04:38
Now, suppose the maze branches twice from the starting point,
66
278438
3340
미로가 시작점에서부터 두 개로 갈라진다고 가정하겠습니다.
04:41
and at every intersection, Hedge’s copies—
67
281778
2982
각 분기점에서 헤지의 복제품을
04:44
let’s call them Twig 1 and Twig 2—
68
284760
2860
가지 1호와 가지 2호라 합시다.
04:47
make more copies— let’s call them Leaves 1 through 4.
69
287620
5007
복제품을 더 만들어서 잎 1호에서 잎 4호까지로 부른다면
04:52
Three Leaves will be destroyed.
70
292627
3120
세 개의 잎은 파괴될 것입니다.
04:55
The one that reaches the artifact will radio back the right answer,
71
295747
4116
상징에 도달한 복제품은 바른 길을 무선으로 회신합니다.
04:59
but only to its parent.
72
299863
1980
그러나 모체에게만 전달이 됩니다.
05:01
So if Twig 1 or 2 is waiting at an intersection
73
301843
3880
가지 1호나 2호가 분기점에서 기다리고 있다면
05:05
and hears something over the radio,
74
305723
1990
무선을 통해 경로를 전달받고
05:07
that’s the right way to go to the artifact from where it is.
75
307713
3560
현재 위치에서 상징의 위치로 가는 옳은 경로를 알게 됩니다.
05:11
To tell Hedge the right answer from his perspective,
76
311273
3290
헤지에게 그의 관점에서 바른 길을 알려주기 위해서
05:14
the Twig should say which way it went,
77
314563
2440
가지 1호는 자기가 어느 길로 갔는지와
05:17
and then the route it just heard over the radio.
78
317003
3600
자기가 무선을 통해 들은 길을 알려줘야 합니다.
05:20
This same process will work no matter how many times the maze branches.
79
320603
4790
미로가 몇 개로 갈라지든지 같은 방식으로 작동합니다.
05:25
Any answer a copy hears on the radio
80
325393
2960
복제품이 무선으로 들은 결과는
05:28
must be the way to the control room from its location,
81
328353
3300
그 위치에서 통제실로 가는 길일 테고
05:31
and if it then adds the branch it took,
82
331653
2350
거기에 자기가 온 길을 얹어서 알려주면
05:34
it can tell its parent how to get there as well.
83
334003
3220
자기의 원본한테 길을 알려줄 수 있게 됩니다.
05:37
We can sum up the instructions in an action called Pathfinder
84
337223
4000
개척자라는 이름으로 지시를 요약할 수 있는데
05:41
that every version of Hedge will follow:
85
341223
3130
모든 헤지들이 따를 방식입니다.
05:44
1. If you’ve reached the artifact,
86
344353
2290
1. 대상에 다다르면
05:46
radio to your parent whether you got there by going left or right.
87
346643
4094
왼쪽으로 갔는지 오른쪽으로 갔는지를 자기의 원본에게 알려줍니다.
05:50
2. When you reach an intersection, move off the conveyor
88
350737
3830
2. 분기점에 도달하면 컨베이어에서 벗어나서
05:54
and send new copies down the left and right paths.
89
354567
3980
새 복제품을 왼쪽과 오른쪽 길로 보내고
05:58
Have them each run Pathfinder.
90
358547
2280
각각 개척자를 실행시킵니다.
06:00
This is where recursion comes in,
91
360827
2040
여기서 재귀를 사용합니다.
06:02
and this may happen many times before the last instruction triggers, which is:
92
362867
5094
마지막 지시가 실행될 때까지 개척자는 여러 번 반복될 것입니다.
06:07
3. If you hear anything over the radio, you should radio to your parent
93
367961
4987
3. 무선을 통해 무엇이든 듣게 되면 자기의 원본한테 전달합니다.
06:12
whether you got to your spot by going left or right,
94
372948
3629
자기가 택한 길이 왼쪽인지 오른쪽인지와
06:16
then repeat everything you just heard.
95
376577
2850
자기가 들은 모든 걸 반복하는 거죠.
06:19
Pathfinder is an example of what programmers call functions,
96
379427
3996
개척자는 프로그래머가
기능, 하위 루틴, 절차라고 부르는 것의 한 예입니다.
06:23
subroutines, or procedures.
97
383423
2690
06:26
No matter the terminology, the idea is the same—
98
386113
3390
용어와 상관없이 개념은 같습니다.
06:29
it’s a set of instructions given a label so that it can be easily reused—
99
389503
4794
쉽게 재사용할 수 있도록 이름을 정한 일련의 지시인 거죠.
06:34
perhaps even by itself.
100
394297
2310
자기 자신을 포함할 수도 있고요.
06:36
And in our case that’ll work perfectly—
101
396607
2976
우리의 과제에서는 재귀가 완벽하게 작동할 겁니다.
06:39
an entire network of paths mapped using just three instructions.
102
399583
5230
단 세 줄만으로 전체 경로를 파악할 수 있죠.
06:46
So here's what happens.
103
406257
1630
이런 식으로 진행됩니다.
07:09
By the time the patrol rounds the corner, Ethic and Lemma have improvised disguises.
104
429760
5777
순찰대가 모퉁이를 돌아올 때 에틱과 렘마는 급히 변장을 합니다.
07:15
They try to confuse the bots long enough to buy Hedge time.
105
435537
4120
헤지에게 시간을 주기 위해 순찰대 봇을 헷갈리게 만들려 하죠.
07:31
Finally, Hedge’s radio crackles to life with a series of directions.
106
451473
4778
마침내 헤지는 지직거리는 무선을 통해 일련의 경로를 받습니다.
07:36
The three dive onto the conveyor and flee for their lives,
107
456251
3850
셋은 컨베이어 안으로 뛰어들어
맹렬히 추격하는 집행자 봇 무리로부터 도망칩니다.
07:40
with a squadron of enforcer bots in hot pursuit.
108
460101
3720
이 웹사이트 정보

이 사이트는 영어 학습에 유용한 YouTube 동영상을 소개합니다. 전 세계 최고의 선생님들이 가르치는 영어 수업을 보게 될 것입니다. 각 동영상 페이지에 표시되는 영어 자막을 더블 클릭하면 그곳에서 동영상이 재생됩니다. 비디오 재생에 맞춰 자막이 스크롤됩니다. 의견이나 요청이 있는 경우 이 문의 양식을 사용하여 문의하십시오.

https://forms.gle/WvT1wiN1qDtmnspy7