Transcript from the "Submarine Navigation Problem" Lesson
>> Who here knows what advent of code is? We got one, we got two, we got three, yeah, four, yeah, five, all right, full, everyone here knows it. If you know what advent of code is, of course, definitely type one in chat, it's a fantastic thing. The best part about it is Mr. Santa himself, he gave me the permission to do this for Frontend Masters.
[00:00:20] I just have to cite him, right? Fantastic, what a nice guy. Thank you, Eric, I appreciate this. You should definitely check it out. I think it's one of the best ways to start learning a new language. Simple problems that get progressively more complex that allows you to learn a lot about their STD, right?
[00:00:35] Exactly what they have to offer to you, but you don't have to have all the nonsense complication of actually building something that you get frustrated with and all that, right? And if you can't solve that one problem, you just move on to the next thing, right? Just fun, it's actually how I started learning Rust.
[00:00:50] So we're gonna actually go over three of these problems. I've picked the easiest problems just more string processing problems. Cuz like I said, I feel like string processing, great way to learn a language, what it has to offer, how it does things differently than other languages. And so, we're gonna do that.
[00:01:05] So without all the fluff and fiesta, festive fun of advent of code, if you read it, the elves are always somehow messing up Santa, that Santa has to do all these crazy things to get everything back in track. And so this one your submarine is looking for, I believe, a pair of keys that the elves actually lost overboard.
[00:01:24] That's the whole plot to the story. And so we have these three rules. You have a submarine that starts at position 00. You parse input to direct your submarine. You multiply your depth by your x progression to get the answer. That means, when you go forward 5, your x moves forward by 5.
[00:01:45] When you go down 5, your y increases by 5, cuz it's a submarine in depth, right? When you go forward 8, you get it, up 3 decreases your depth, right? So it's backwards. It's the trick of the problem, very, very simple, right? You just have to make things go a little bit, there you go.
[00:02:03] I even put the little note there, you get it? Awesome.