Same Line
All this just to get back to where we started from. In this video we will create the exact same thing that we did in our first hour we will create a shape that starts and ends in the same line that it originated from.
Video Transcript
00:00So just to summarize what we've done so far at this stage now
00:03We know whenever we start going out of the dot we know between what two dots were in
00:08We also know what are their ending destinations?
00:11What are the two dots that we're going to now the only last thing that's left for us is really to actually
00:16Create that whole thing
00:18Create the drawing of it and not leave it open as we are right now, which is our next challenge
00:24Alright, so before we even solve this challenge, let's start going on to the next step
00:29So first of all here, we just put it our get line when it's safe just for really just for the beauty of it
00:35But we really what we wanted to do is we want to take these two lines and we probably want to or maybe even just this
00:41Get line and we want to move it into the add safe PG because that's the heart of everything. That's where we're going to start
00:48actually
00:49Creating a different drawing lines a different mapping to what we have here right now
00:54So really all that we have all the drawings that we're doing right now is going to be irrelevant from now on
00:59Because we're going to have to find a better solution
01:02So the first thing I want to do is I want to get my new line
01:05So first of all, my new line is going to be just another variable
01:09It's going to be a new line and that's going to be our new line
01:15Now the last thing that I have left to see to see is first of all
01:18I want to see am I still between the same dots if I am between the same dots
01:23What does that mean that means that nothing really changed if I'm between if I came from here
01:28And I'm back into the same place then with the logic that I had previously is good enough still
01:35Only thing is that only thing is I have to add into it is now I have to add into it
01:39Oh, so that extra extra model of breaking my my
01:44My corners that I have right now my V points my points that are storing oops
01:48But my points that are storing this information need to change. So let's start from that because that's the easy one
01:54That's the one we already created and if we're going back to the ad safe BG, which we know
01:59That's where we're actually going to create our
02:02We know that we have to create the shape already here
02:05It's time for us to start asking questions start seeing if we're in that safe zone or still or not
02:11Now you might be thinking we we always know
02:15That the dots we're getting are always going to go from up and upwards
02:19In other words, if we are going if we're getting two three and our return line would have to be two three as well
02:26If it's in the same line
02:28now on top of that
02:30It could it would have to be if if we know that we're in line
02:35two
02:37three then it would have to be if we if a is two then
02:43When we're looking at this the lines if line a is
02:47Two three and line B is two three the same easy
02:51but you might be thinking okay, but if B is if it's BC and
02:55CD then B would be our a
02:58Just look at this. The it's a little bit hard to comprehend
03:01But the a we're always going from lower to bigger
03:04That means our a is always the smallest value
03:06It can never be the bigger value because we're always looping from the smallest to the biggest
03:10that's in other words if I say here if if
03:14If what did how do we call it? We called it. Oh line. I believe right? Oh
03:19Line is our main one. So if o line
03:22dot a equals equals
03:25new line
03:27Dot a what does that mean?
03:28That means and it has to mean that we went back a full square
03:33We went back to the line that we started from because we're if it's two it's two and three, right?
03:38So let's test this theory out
03:41And let's just trace here
03:43back home
03:50Function does not have a value. Ooh
03:53That worked a second ago, right? It's just add here a return
04:15Nothing. Oh we get to return the old line as well here
04:18But this is it's just not gonna return the dots which means it didn't find even though that should never happen
04:23Just so we don't get this error
04:27All right
04:28Now if I go to the right
04:30It's not gonna find anything right if I go to the left
04:33It's not gonna find anything either
04:35Another and if I go up and I come right back down, it should tell me back home and that's good
04:40All right
04:41So we already know that only if we're going back to the same dot that we started from the same line that we started
04:46From this if statement is going to happen in that case. We don't have to add anything
04:51All we have to do is
04:53Actually split our current line and just add into it the new dots. We want to add into it
05:00What we want to add into it that uh
05:03Where are we we want to add that V path
05:06Basically, what we want to do is we want to add our V path where we want to add it between two and three because our
05:12Lot are done is between two and three in other words
05:15All we have to do is just create another we basically want to draw the line that doesn't change at all
05:20We could still draw it. We don't have to add anything into our lines
05:23So just to make this work and I'm just gonna make my ad safe to BG
05:27I'm just gonna create another function down here a quick function
