[Script Info] Title: [Events] Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text Dialogue: 0,0:00:00.84,0:00:05.83,Default,,0000,0000,0000,,This is just a short section to introduce\Na type of puzzle, which is built on Dialogue: 0,0:00:05.83,0:00:10.87,Default,,0000,0000,0000,,the sort of image manipulation code we've been doing. So the idea is, there's a picture of some Dialogue: 0,0:00:10.87,0:00:15.80,Default,,0000,0000,0000,,mystery object. And the red, green and blue values in the image have just been Dialogue: 0,0:00:15.80,0:00:21.03,Default,,0000,0000,0000,,messed up in some way. And so, what\Nyou need to do is write code to fix the Dialogue: 0,0:00:21.03,0:00:26.45,Default,,0000,0000,0000,,red, green, and blue values, and so reveal\Nthe original image, and, and see what it is. Dialogue: 0,0:00:26.45,0:00:31.94,Default,,0000,0000,0000,,So, here is an example I'm gonna do\Nhere. This is the so called "Gold Puzzle". Dialogue: 0,0:00:32.14,0:00:37.49,Default,,0000,0000,0000,,And, the idea, so there's, there's, some\Nobject is shown here. And what's happened with this Dialogue: 0,0:00:37.49,0:00:43.38,Default,,0000,0000,0000,,is that, first of all, the green\Nand blue values in the image have been just Dialogue: 0,0:00:43.38,0:00:49.42,Default,,0000,0000,0000,,set with random values between zero\Nand 255. And actually, if you look at it, Dialogue: 0,0:00:49.42,0:00:52.71,Default,,0000,0000,0000,,so it gives a kind of a, a snowy\Nappearance. And it, you can kinda see, there's, Dialogue: 0,0:00:52.71,0:00:56.66,Default,,0000,0000,0000,,so there's some pixels where the\Ngreen is very high, some pixels where the blue is very high, Dialogue: 0,0:00:56.66,0:01:00.43,Default,,0000,0000,0000,,they just look blue or green; and then there's these sort of turquoise pixels scattered through; Dialogue: 0,0:01:00.43,0:01:04.33,Default,,0000,0000,0000,,so those are cases where, both the blue and the green are high. So that's one, Dialogue: 0,0:01:04.33,0:01:08.24,Default,,0000,0000,0000,,one level of mess-up in this image. The other thing that's happened Dialogue: 0,0:01:08.24,0:01:12.91,Default,,0000,0000,0000,,is that the image that we wanna recover, it's in the Dialogue: 0,0:01:12.91,0:01:17.68,Default,,0000,0000,0000,,red values. In fact, it's exclusively in the red values. The green and blue are just, sort of, garbage. Dialogue: 0,0:01:17.68,0:01:22.64,Default,,0000,0000,0000,,But the values have been divided by ten, so they're very dark. So, kind of what we're seeing here Dialogue: 0,0:01:22.64,0:01:27.17,Default,,0000,0000,0000,,in the obscure version, is, there's, there's a dark red image Dialogue: 0,0:01:27.17,0:01:32.00,Default,,0000,0000,0000,,behind there. And it's been covered with this, sort of bright random Dialogue: 0,0:01:32.00,0:01:37.62,Default,,0000,0000,0000,,green blue snow, so we can't see it. So what we want to do is, write code to fix it. Dialogue: 0,0:01:37.62,0:01:46.02,Default,,0000,0000,0000,,So let me start off here. So as usual, for these, I'm going to start off Dialogue: 0,0:01:46.02,0:01:50.59,Default,,0000,0000,0000,,with just a blank text area to just write the code. And then down here there's a solution, Dialogue: 0,0:01:50.59,0:01:55.21,Default,,0000,0000,0000,,"Show solution" button. So if you wanted to visit this page and try it yourself, you can, you can get the code that way. Dialogue: 0,0:01:55.21,0:01:59.45,Default,,0000,0000,0000,,Alright, so the first thing I want to do, so here's, here's what it looks like if I just run it right here: Dialogue: 0,0:01:59.45,0:02:03.63,Default,,0000,0000,0000,,the loop is empty; so if I run it, we just, we just get the, the puzzle image raw. Dialogue: 0,0:02:03.63,0:02:07.75,Default,,0000,0000,0000,,Alright, so the first thing I'm going to do is I'll say Dialogue: 0,0:02:07.75,0:02:12.15,Default,,0000,0000,0000,,pixel.setGreen(0) Dialogue: 0,0:02:12.15,0:02:16.55,Default,,0000,0000,0000,,I'm going to punch out the green\Nvalues. I'm just going to get rid of them Dialogue: 0,0:02:16.55,0:02:22.11,Default,,0000,0000,0000,,and we'll see what we get. Hmm, alright,\NSo now, well, it's better. Now, we just Dialogue: 0,0:02:22.11,0:02:29.37,Default,,0000,0000,0000,,have this blue snow. We've at least gotten\Nrid of the green snow. So I'll get rid of the blue snow as well. Dialogue: 0,0:02:29.37,0:02:36.02,Default,,0000,0000,0000,,So I'll say, pixel.SetBlue(0), we'll try that. Dialogue: 0,0:02:37.22,0:02:42.80,Default,,0000,0000,0000,,Alright, hmm, So, I, I've got rid of the\Nsnow. But now the problem is that the Dialogue: 0,0:02:42.80,0:02:48.83,Default,,0000,0000,0000,,image, which is in the red values. It's\Njust so dark, we can't see it. So it is, Dialogue: 0,0:02:48.83,0:02:54.56,Default,,0000,0000,0000,,it's technically there, but it's invisible. So what I need to is scale it back up, Dialogue: 0,0:02:54.56,0:03:00.22,Default,,0000,0000,0000,,right? It's down there, I just need to make it brighter. So I'll say pixel.setRed of Dialogue: 0,0:03:00.22,0:03:05.00,Default,,0000,0000,0000,,pixel-dot-getRed" Looks a little bit like the five, ten, twenty Dialogue: 0,0:03:05.00,0:03:09.83,Default,,0000,0000,0000,,puzzles here. So I'm gonna, in this case, the instructions say that it was scaled down Dialogue: 0,0:03:09.83,0:03:14.54,Default,,0000,0000,0000,,by a factor of ten. So I'll scale the red back up by a factor of ten. Dialogue: 0,0:03:14.54,0:03:19.89,Default,,0000,0000,0000,,Huh, there we go. So that, that is the solution image. So, Dialogue: 0,0:03:19.89,0:03:25.06,Default,,0000,0000,0000,,this is a picture of the Golden Gate Bridge, as seen from\Nthe San Francisco side. Now, Dialogue: 0,0:03:25.06,0:03:30.51,Default,,0000,0000,0000,,it's a little, obviously, it doesn't look quite\Nright. What's happened, is that, because Dialogue: 0,0:03:30.51,0:03:35.83,Default,,0000,0000,0000,,the data is exclusively in the red, even\Nwhen we recover it, it just looks red. I mean, what's, Dialogue: 0,0:03:35.83,0:03:40.68,Default,,0000,0000,0000,,what's happened, actually. Is this\Nis an essentially a black and white image Dialogue: 0,0:03:40.68,0:03:45.21,Default,,0000,0000,0000,,and normally those are shown on a, on a\Nsort of black to white spectrum. In this case, Dialogue: 0,0:03:45.21,0:03:49.92,Default,,0000,0000,0000,,the image is being shown on a black\Nto red spectrum. So it is the right image but it just, Dialogue: 0,0:03:49.92,0:03:54.62,Default,,0000,0000,0000,,it has this red cast. For this sections we're gonna say that's good enough: you know, Dialogue: 0,0:03:54.62,0:03:59.38,Default,,0000,0000,0000,,you can see what it's supposed to be. In a later section I'll show how to, Dialogue: 0,0:03:59.38,0:04:04.26,Default,,0000,0000,0000,,how to fix that. And get it to look like a, a proper black and white image.