The Prison Break | Think Like A Coder, Ep 1 — Transcript
Full transcript
- 0:29Upon emerging from stasis, Ethic is the unfortunate recipient of three surprises.
- 0:37The first: a prison cell.
- 0:40The second: complete amnesia.
- 0:43And the third: a mysterious stranger has gotten stuck
- 0:47squeezing through the bars on her window.
- 0:50His name is Hedge, and he has come to help Ethic save the world.
- 0:56But first they have to break out of jail.
- 0:59Hedge turns his hand into a lockpick and outlines the challenge ahead.
- 1:05Each lock in the prison works in the same unusual way.
- 1:10Inside the keyhole is a red dial that can be rotated to one of 100 positions
- 1:17numbered 1 through 100.
- 1:19The key for a given cell spins the dial to the right position,
- 1:24which, when stopped there, makes it turn green and unlocks the door.
- 1:28It would be out of the question to steal keys from a guard,
- 1:33but Hedge has a better idea.
- 1:36Hedge can carry out Ethic‘s commands.
- 1:39If Ethic tells him to walk 5 steps forward,
- 1:42turn right, then walk another 5 steps,
- 1:46that’s exactly what he’ll do.
- 1:49Hedge needs specific instructions though.
- 1:52If Ethic says “pick the lock” or “try every combination”
- 1:57that would be too vague, but “spin the dial 5 positions forward” would work.
- 2:03Once out of the cell, they will only have a few moments to crack the lock
- 2:07for the outer prison door too before the guards catch them.
- 2:12So what instructions will allow Hedge to efficiently open any door?
- 2:20Pause now to figure it out for yourself.
- 2:25Before we explain the solution, here’s a hint.
- 2:30A key programming concept that can help unlock the door is called a loop.
- 2:37This can be one or more instructions that Hedge will iterate— or repeat—
- 2:42a specified number of times,
- 2:46like “jump up and down 100 times.”
- 2:50Or an instruction that Hedge will repeat until a condition is met,
- 2:55such as “keep jumping up and down until it’s 7 o’clock.”
- 3:00Pause now to figure it out for yourself.
- 3:06The first thing that’s clear is that you need to find a way for Hedge
- 3:10to try every combination until one works.
- 3:14What takes a little more effort is how exactly you do so.
- 3:18One solution would be to instruct Hedge to try every combination in succession.
- 3:23Try 1 and check the light.
- 3:26If it turns green, open the door, and if not, try 2.
- 3:32If that doesn’t work try 3. All the way up to 100.
- 3:38But it would be tedious to lay that out in its entirety.
- 3:41Why write more than 100 lines of code,
- 3:44when you can do the same thing with just 3?
- 3:48This is where a loop comes in.
- 3:50There are a few ways to go about this.
- 3:53The lock has 100 positions,
- 3:56so Ethic could say “Check the dial’s color, then spin the dial forward once,
- 4:02for 100 repetitions.
- 4:06Remember where the dial turns green, then have Hedge set it back to that number.”
- 4:13A loop like this, where you specify the number of times it repeats,
- 4:17is called a “for" loop.
- 4:20But an even more efficient loop
- 4:22would have Hedge spin the dial one position at a time until it turns green
- 4:27and as soon as that happens, have him stop and open the door.
- 4:31That way if the door unlocks on 1,
- 4:35he doesn’t need to cycle through all the rest of the numbers.
- 4:39This is an “until” loop,
- 4:42because it involves doing an action until a condition is met.
- 4:47A similar, alternate approach would be to turn the dial while it’s still red,
- 4:52then stop.
- 4:54That’s called a “while” loop.
- 4:58Back to the adventure.
- 4:59Hedge loops through the combinations, and the cell opens at 41.
- 5:07Ethic and Hedge wait until the perfect moment in the guards’ rotation
- 5:10and make a break for it.
- 5:14Soon, Ethic faces a choice: hide inside a mysterious crystal,
- 5:19or try to crack the outer door and make a run for it.
- 5:23Ethic chooses to run.
- 5:28The second door takes Hedge longer, requiring him to spin all the way to 93.
- 5:34But he gets it open
- 5:43and takes the opportunity to explain why he’s rescued Ethic.
- 5:48The world is in turmoil:
- 5:50robots have taken over, and only Ethic can set things right.
- 5:54In order to do so,
- 5:55they’ll need to collect three powerful artifacts
- 5:58that are being used for nefarious purposes across the land.
- 6:01Only then can Ethic return to the world machine— that giant crystal—
- 6:05to set things right.
- 6:19Ethic may have escaped the prison…
- 6:22but what has she gotten herself into?
About this transcript
This page contains the full transcript of The Prison Break | Think Like A Coder, Ep 1 by TED-Ed, generated from the public captions YouTube serves with the video. The transcript has 753 words across 81 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.
What you can do with it
Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to translate the transcript into 100+ languages.
Free YouTube transcript tool
YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, translation to 100+ languages, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.