So notice like the programs that we've been running that are based in bra in particular, the polygon programs and draw a square or draw a triangle. He's programs like forever, a quick best eye. What was the program? Be what would be call and draw whatever I could say. What are the values of size and angle? If we wanted to draw a circle with this function power or something, One. Yeah, let's try that. So, we have size deep sizes. And technically, this isn't a circle like this is Looks pretty circulation. The fair across the nation perfectly reasonable for that resolution of our anyway. So these these procedures this polygon procedure it like to reads forever. So once that's dropped done drawing one circle, remember what if we wanted to write the polygon function that stopped and in particular, what if we wanted to write a function? That generated polygons but that's stopped only from like the perspective of the turtle. So knowing only what the turtles know. So the turtle doesn't know anything about like the cartesian coordinate system, right? It only knows like it's current heading, effectively, you know, what knows? I'm like walking, and I'm currently like, facing indirect in this direction, I am where I can. So what would it take for us to write a procedure? A polygon procedure that only executed once only using the information that's available to the turtle any yes. So effectively, like how does the turtle know when it should stop? When it's kind of come back around and closed the shape. It can count, whatever broke here. Couple pretty. Yes, I love your intuition, I love that. So let's say, let's just think about the case of a triangle. What could we? How could we write like a triangle function that stops and then in terms of you know then we're going to have to generalize that they're thinking back like the to the square and triangle functions that we wrote how Okay, so let me see. Let's do it. Go back. So, I think I like this, so, let's you function here. Boy called. Let's see. So, So you want to capture like information about how many times it should go around some of the number of sides of the polygon and what is the number of sides. In terms of the variables, we have access to. This is what you work for posing. Calculating like where would we get the three? Right, so we know the angle. We're passing an angle remember 50 / 7. Yeah, exactly. So, 360 divided by and then we can say for What do you think? Let's try hundred and five of an angle of one. Anybody, I'm a suggest any adjustments or changes. Attract, we need to cast that. Okay. Say Margo. Awesome. Tiny. Yay, square. The angle of five. Good looking good about. And our greeters and angle working for Not close polygon. So wrong. We want I want this procedure to like, generate a closed shape. This is generating an open shape. Let's look at the way. This, this shape was drawn when we had a looping. When we moved stop drew, this closed polygon, how can we edit our polygon procedures so that it will work for these cape so that it will work for angles that are greater than and your intuition was exactly right beginning. So what did you say? Could you say that thing? Way. I feel like if you need to make sure that's the angle, the angle of grace. Exactly, exactly. So, let's think about Exactly, right? So yeah. So where does the turtle need to be? At the end of our polygon procedure, in terms of position, exactly what I started, right? And then it's angle should be like, also exactly the same angle where I started, right? Then we know it went all the way on this path and came back exactly where it started. We know that this shape will be the let's try that capture that like intuition. So let's kind of add a variable that we're going to call rotation and rotation is going to keep track where we are in terms of how many degrees we turn so far. So I'm going to say one of this number of sides. Just as initially zero. And is modular 360. Don't know where kind of not started. Because your 360 equals 0, so it's going to start. Okay. Of that fixes our problem. So thinking about things in terms of like the amount of turning that's a turtle has undergone and then and understanding that it has closed the shade and it's holding one, it's come back, both to it, starting position. Questions about that. Looked at like just this, that's procedure that I'm putting other value. Falls. And what think about some of the map here? Let's think about how many rotations safe space to generate. So this we have to loop for kind of two, two iterations of 360 before we got back from where we started. So this this we're not closed yet and there were more than 360 but we haven't returned home. There were more than 360 but we haven't returned home. And then finally, there were seven 20 and you return To go back this. Let's look at care what you made 4/3 into 7 5/76 and Let's let's kind of formalize this understanding and see if we can come up with like precise, medical kind of encapsulation of this knowledge. And so, the book proposed proposes, what they called the closed path hereum, which says, essentially like formalizing your original intuition, which is the total rotation along any path is an instrumental. And so if we and the definition of closed, critically is the school returns to its same position. And as the same and heading this exercise, important ask positions, These have a rotation number of one. So the original kind of classic polygons that we check have this rotation where they just rotate once, that would be with our code here, 20. That's the total number of terms is one, and a total rotation is Also, one states that have non-profit here. Two, this angle is 50. Let's see. What's a? So here have to do kind of five times 50 before we get to remote control, but 360 And then something like, Right. On yet, actually go around 41 times. The, the number of terms here is actually 41. Questions about that. So this is back to our theorem that was fast here and says that the total rotation along any equation, path is an integer multiple of 260, like expand that or stay that in a slightly different way. And you can say something about our procedure actually or polygon halt procedure. You can say that in half the drawn by the polygon part procedure will close. Exactly. When that rotation reaches, an integer, multiple of note that our couple of year exceptions and we encountered one of them and when I originally wrote that procedure, so one is like zero. You don't generate a closed procedure. Stay in place. Similarly if we don't ever go forward if the sizes zero and we're just like spinning around it place we can like spin around forever and not was shape. Right? So there's some funny little ways in which mess this up, but what for, you know, for most he says this will hold for us. So more examples of food, polygons that you would like to some of these scenes already today. So many questions trying to get more set of topics like in today before we I'll mention just that you can now, like, layer up some of this stuff that we've done. Can like, You can kind of blend these things to make like beautiful. Here I'm right. Drawing rotating a little bit after I draw the polygon. Too much of that, for you all to explore as part of Go ahead and save this program. Chart. And, One handy tool that has built-in for processing at all. Mentioned, electer about. Glue. These are used the RGB. One of the things about like a procedural representation. So like a computer science representation of that is really another thing. That's really different about. Like traditionally completing geometry is that it. Let's you kind of do things that you would like to just never even think to do in coordinate geometry at all. One of them is that we can think of like kind of the original medical. We can think of the turtle as a little animal and we can think of a this little animal like walking around or moving around. So let's start to write some animals like programs thing that like to add a draw thing that it's like, you know, about animals or they tend to not like make perfectly beautiful geometric shots shapes like when they walk around they like, you know, animals like speedy like walk around and they're somewhat random ways. So, let's define. They got forward. Now I'm going to just walk a random amount forward profit and built-in random function. I'm going to take between one what they intend the steps and then I'm going to let's just go to the hexagon left, right? Move last summer, random amount. How to turn off and grow it, because going mostly forward little kind of most of these just kind of walk right off. That's framed. Started. If we to kind of move for a little bit, but be more inclined to stay on the screen. Say the more likely to move, maybe sometimes to do mine in the minus direction, but more likely to move. Random movement that has a tendency to like ESPYL kind of stay on the screen and spiral around it has like the think of this guy is having like it, you know, counter and clockwise orientations like some move around randomly. But since clock notice that we're drawing out like a trace of like, wherever this guy is. Then on our screen can use the frontier processing. Could say going to draw a trans slightly translucent rectangle? Still. So here, what I've done, I set a fill color and I added an alpha. So, the outlets of the print zero being totally transparent and 255. Being until I set that solo color to even the same color as my background, but very, very transparent. And then I draw a rectangle that fills the whole screen. Every time I do draw and the effect of this, is for the turtles and still see it on your screen, but it gradually like where it's gone in the past or less dark than where currently is, just kind nice way to visualize both in history, but also kind of emphasizing his current position. One thing that animals do is they might be like attracted to something but, for example. So let's see if we can get this. This little turtle animal. That right now is just kind of swirling around. Let's say if we can get it to like be attracted to where my mouth pointer, really let's say like there's something that smells really good at where my mouth pointer is. Let's think about some variables to try to capture snow float of location of the smell acts. Why? And then we're going to make some variables. Just let us do a little like local optimization. We're going to say distance. Let's make a function words. I'm gonna. Initializing technologies. With the best. We? He is. Move a little bit calculate. New distance know is equal to posit get some functions. This is that. And you can say, okay, I get Get blending equilibrium five properly about that since we want to say, if Is greater than the previous. That's bad. So that means I moving away from what might I want to do. If I know like okay I was like here and this was my previous kind of location of my turtle and then I moved here and I'm now like further away from the orb or even worse like that. So now I'm there and I moved away from this smell, what one I wanted you to like, try that yet back towards this metals. Yeah. In fact you can just like her, what's it? Let's start really simple. Let's deep do like. And between. Is actually will take the, buy it out of the typical land of those little bit smaller step, so it will change that. So it's more like a straight move, but if we find that we're moving away from the smell, let's turn just so random amount. We'll see. We need to do. So we're gonna move a little bit. See if we're further away from the smell than we look before. If we're further away, we'll move. Beautiful. Other thing, you Okay, that's Okay, so here's my mouse way. It found the smell. Now, and you can see, like, it's paint fast on your screen but by now, imagine what you could do, if we add or just we have one turtle here. Imagine you can just make some small, an average whole school of a little turtles. Chasing around goal. Imagine you could change those procedure slightly to instead of making it like this smell like yeah, model stuff like predator again. So we're coming to the end of today's class but next week, your assignment for Tuesday is to just blame which some of the like amazing richness that is really here. In this formulation we'll talk a little bit more about kind of turtle and logo on Thursday and some of like some of these kinds of techniques and then we'll also start to stones and how we can use the turtle paradigm. Also to model botanical systems, you can put this structure hotels. Thank you all have a great rest of your day. I look forward to seeing you on Thursday. Any questions or yeah, are the slimes online someone. Yeah, let me show you. So, I will always post them in the five for the last couple of videos here on our schedule. So, of course introduction, like they're here. So yeah. Yeah. Oh yeah, there was someone in like every city. Five, five. I think it's not like yeah, you should be It was, I think maybe after the very last song to If you are coming, welcome. Sorry, is there was something important because I think oh no, it just I automatically submit. So you just like what you people so cute. And I'm not thinking ability. Once you do that issue, but shit now, Oh, so it's just it's weird because there's but you can sign in and change, so it's just like, you just remember, you put your world. These days you don't have to fall, so go back to it. But oh yeah. But of visible was like when you're available as green. Called. So I think my part about, that's okay that the book, this is not like you won't get a grade on it. It's just my need to know and everything special is so I can have the so you still need because I will determine when We have when Thank you. And will you post the move for the smell? Yeah, I will because I think if normal But I think the position of the, okay? But you know what? It means then, you know. So you want that line and want that and you're relatively straight into it only because I find that I think their money is phone will call back home. Four always across and