[Script Info] Title: [Events] Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text Dialogue: 0,0:00:29.94,0:00:37.38,Default,,0000,0000,0000,,Upon emerging from stasis, Ethic is the \Nunfortunate recipient of three surprises. Dialogue: 0,0:00:37.38,0:00:40.34,Default,,0000,0000,0000,,The first: a prison cell. Dialogue: 0,0:00:40.34,0:00:43.50,Default,,0000,0000,0000,,The second: complete amnesia. Dialogue: 0,0:00:43.50,0:00:47.21,Default,,0000,0000,0000,,And the third: a mysterious stranger \Nhas gotten stuck Dialogue: 0,0:00:47.21,0:00:50.87,Default,,0000,0000,0000,,squeezing through the bars on her window. Dialogue: 0,0:00:50.87,0:00:56.42,Default,,0000,0000,0000,,His name is Hedge, and he has come \Nto help Ethic save the world. Dialogue: 0,0:00:56.42,0:00:59.96,Default,,0000,0000,0000,,But first they have to break out of jail. Dialogue: 0,0:00:59.96,0:01:05.97,Default,,0000,0000,0000,,Hedge turns his hand into a lockpick and \Noutlines the challenge ahead. Dialogue: 0,0:01:05.97,0:01:10.62,Default,,0000,0000,0000,,Each lock in the prison works \Nin the same unusual way. Dialogue: 0,0:01:10.62,0:01:17.25,Default,,0000,0000,0000,,Inside the keyhole is a red dial that can \Nbe rotated to one of 100 positions Dialogue: 0,0:01:17.25,0:01:19.70,Default,,0000,0000,0000,,numbered 1 through 100. Dialogue: 0,0:01:19.70,0:01:24.04,Default,,0000,0000,0000,,The key for a given cell spins the dial \Nto the right position, Dialogue: 0,0:01:24.04,0:01:28.91,Default,,0000,0000,0000,,which, when stopped there, makes it turn \Ngreen and unlocks the door. Dialogue: 0,0:01:28.91,0:01:33.63,Default,,0000,0000,0000,,It would be out of the question to steal \Nkeys from a guard, Dialogue: 0,0:01:33.63,0:01:36.76,Default,,0000,0000,0000,,but Hedge has a better idea. Dialogue: 0,0:01:36.76,0:01:39.50,Default,,0000,0000,0000,,Hedge can carry out Ethic‘s commands. Dialogue: 0,0:01:39.50,0:01:42.70,Default,,0000,0000,0000,,If Ethic tells him to walk \N5 steps forward, Dialogue: 0,0:01:42.70,0:01:46.17,Default,,0000,0000,0000,,turn right, then walk another 5 steps, Dialogue: 0,0:01:46.17,0:01:49.72,Default,,0000,0000,0000,,that’s exactly what he’ll do. Dialogue: 0,0:01:49.72,0:01:52.84,Default,,0000,0000,0000,,Hedge needs specific instructions though. Dialogue: 0,0:01:52.84,0:01:57.00,Default,,0000,0000,0000,,If Ethic says “pick the lock” or \N“try every combination” Dialogue: 0,0:01:57.00,0:02:03.68,Default,,0000,0000,0000,,that would be too vague, but “spin the \Ndial 5 positions forward” would work. Dialogue: 0,0:02:03.68,0:02:07.71,Default,,0000,0000,0000,,Once out of the cell, they will only have \Na few moments to crack the lock Dialogue: 0,0:02:07.71,0:02:12.22,Default,,0000,0000,0000,,for the outer prison door too before \Nthe guards catch them. Dialogue: 0,0:02:12.22,0:02:17.70,Default,,0000,0000,0000,,So what instructions will allow Hedge \Nto efficiently open any door? Dialogue: 0,0:02:20.32,0:02:24.40,Default,,0000,0000,0000,,Pause now to figure it out for yourself. Dialogue: 0,0:02:25.78,0:02:30.75,Default,,0000,0000,0000,,Before we explain the solution, \Nhere’s a hint. Dialogue: 0,0:02:30.75,0:02:37.18,Default,,0000,0000,0000,,A key programming concept that can help \Nunlock the door is called a loop. Dialogue: 0,0:02:37.18,0:02:42.51,Default,,0000,0000,0000,,This can be one or more instructions \Nthat Hedge will iterate— or repeat— Dialogue: 0,0:02:42.51,0:02:46.65,Default,,0000,0000,0000,,a specified number of times, Dialogue: 0,0:02:46.65,0:02:50.06,Default,,0000,0000,0000,,like “jump up and down 100 times.” Dialogue: 0,0:02:50.06,0:02:55.24,Default,,0000,0000,0000,,Or an instruction that Hedge will \Nrepeat until a condition is met, Dialogue: 0,0:02:55.24,0:03:00.23,Default,,0000,0000,0000,,such as “keep jumping up and \Ndown until it’s 7 o’clock.” Dialogue: 0,0:03:00.23,0:03:06.25,Default,,0000,0000,0000,,Pause now to figure it out for yourself. Dialogue: 0,0:03:06.25,0:03:10.14,Default,,0000,0000,0000,,The first thing that’s clear is that you \Nneed to find a way for Hedge Dialogue: 0,0:03:10.14,0:03:14.23,Default,,0000,0000,0000,,to try every combination until one works. Dialogue: 0,0:03:14.23,0:03:18.52,Default,,0000,0000,0000,,What takes a little more effort is \Nhow exactly you do so. Dialogue: 0,0:03:18.52,0:03:23.80,Default,,0000,0000,0000,,One solution would be to instruct Hedge \Nto try every combination in succession. Dialogue: 0,0:03:23.80,0:03:26.50,Default,,0000,0000,0000,,Try 1 and check the light. Dialogue: 0,0:03:26.50,0:03:32.35,Default,,0000,0000,0000,,If it turns green, open the door, \Nand if not, try 2. Dialogue: 0,0:03:32.35,0:03:38.24,Default,,0000,0000,0000,,If that doesn’t work try 3. \NAll the way up to 100. Dialogue: 0,0:03:38.24,0:03:41.82,Default,,0000,0000,0000,,But it would be tedious to lay \Nthat out in its entirety. Dialogue: 0,0:03:41.82,0:03:44.25,Default,,0000,0000,0000,,Why write more than 100 lines of code, Dialogue: 0,0:03:44.25,0:03:48.39,Default,,0000,0000,0000,,when you can do the same thing \Nwith just 3? Dialogue: 0,0:03:48.39,0:03:50.68,Default,,0000,0000,0000,,This is where a loop comes in. Dialogue: 0,0:03:50.68,0:03:53.91,Default,,0000,0000,0000,,There are a few ways to go about this. Dialogue: 0,0:03:53.91,0:03:56.26,Default,,0000,0000,0000,,The lock has 100 positions, Dialogue: 0,0:03:56.26,0:04:02.31,Default,,0000,0000,0000,,so Ethic could say “Check the dial’s \Ncolor, then spin the dial forward once, Dialogue: 0,0:04:02.31,0:04:06.20,Default,,0000,0000,0000,,for 100 repetitions. Dialogue: 0,0:04:06.20,0:04:13.01,Default,,0000,0000,0000,,Remember where the dial turns green, then \Nhave Hedge set it back to that number.” Dialogue: 0,0:04:13.01,0:04:17.18,Default,,0000,0000,0000,,A loop like this, where you specify \Nthe number of times it repeats, Dialogue: 0,0:04:17.18,0:04:20.16,Default,,0000,0000,0000,,is called a “for" loop. Dialogue: 0,0:04:20.16,0:04:22.11,Default,,0000,0000,0000,,But an even more efficient loop Dialogue: 0,0:04:22.11,0:04:27.36,Default,,0000,0000,0000,,would have Hedge spin the dial one \Nposition at a time until it turns green Dialogue: 0,0:04:27.36,0:04:31.84,Default,,0000,0000,0000,,and as soon as that happens, have him \Nstop and open the door. Dialogue: 0,0:04:31.84,0:04:35.25,Default,,0000,0000,0000,,That way if the door unlocks on 1, Dialogue: 0,0:04:35.25,0:04:39.25,Default,,0000,0000,0000,,he doesn’t need to cycle through \Nall the rest of the numbers. Dialogue: 0,0:04:39.25,0:04:42.66,Default,,0000,0000,0000,,This is an “until” loop, Dialogue: 0,0:04:42.66,0:04:47.44,Default,,0000,0000,0000,,because it involves doing an \Naction until a condition is met. Dialogue: 0,0:04:47.44,0:04:52.21,Default,,0000,0000,0000,,A similar, alternate approach would be \Nto turn the dial while it’s still red, Dialogue: 0,0:04:52.21,0:04:54.31,Default,,0000,0000,0000,,then stop. Dialogue: 0,0:04:54.31,0:04:58.04,Default,,0000,0000,0000,,That’s called a “while” loop. Dialogue: 0,0:04:58.04,0:04:59.93,Default,,0000,0000,0000,,Back to the adventure. Dialogue: 0,0:04:59.93,0:05:07.03,Default,,0000,0000,0000,,Hedge loops through the combinations, \Nand the cell opens at 41. Dialogue: 0,0:05:07.03,0:05:10.95,Default,,0000,0000,0000,,Ethic and Hedge wait until the \Nperfect moment in the guards’ rotation Dialogue: 0,0:05:10.95,0:05:14.48,Default,,0000,0000,0000,,and make a break for it. Dialogue: 0,0:05:14.48,0:05:19.89,Default,,0000,0000,0000,,Soon, Ethic faces a choice: \Nhide inside a mysterious crystal, Dialogue: 0,0:05:19.89,0:05:23.85,Default,,0000,0000,0000,,or try to crack the outer door \Nand make a run for it. Dialogue: 0,0:05:23.85,0:05:26.12,Default,,0000,0000,0000,,Ethic chooses to run. Dialogue: 0,0:05:28.23,0:05:34.64,Default,,0000,0000,0000,,The second door takes Hedge longer, \Nrequiring him to spin all the way to 93. Dialogue: 0,0:05:34.64,0:05:37.19,Default,,0000,0000,0000,,But he gets it open Dialogue: 0,0:05:43.87,0:05:48.74,Default,,0000,0000,0000,,and takes the opportunity \Nto explain why he’s rescued Ethic. Dialogue: 0,0:05:48.74,0:05:50.47,Default,,0000,0000,0000,,The world is in turmoil: Dialogue: 0,0:05:50.47,0:05:54.54,Default,,0000,0000,0000,,robots have taken over, \Nand only Ethic can set things right. Dialogue: 0,0:05:54.54,0:05:55.70,Default,,0000,0000,0000,,In order to do so, Dialogue: 0,0:05:55.70,0:05:58.16,Default,,0000,0000,0000,,they’ll need to collect three \Npowerful artifacts Dialogue: 0,0:05:58.16,0:06:01.62,Default,,0000,0000,0000,,that are being used for nefarious \Npurposes across the land. Dialogue: 0,0:06:01.62,0:06:05.97,Default,,0000,0000,0000,,Only then can Ethic return to the \Nworld machine— that giant crystal— Dialogue: 0,0:06:05.97,0:06:07.47,Default,,0000,0000,0000,,to set things right. Dialogue: 0,0:06:19.68,0:06:22.52,Default,,0000,0000,0000,,Ethic may have escaped the prison… Dialogue: 0,0:06:22.52,0:06:25.46,Default,,0000,0000,0000,,but what has she gotten herself into?