Hi, welcome to this final video of our path finding series. We're going to conclude this week with a conversation of how this path finding algorithm could be used in different contexts of design, but also stylizing a little bit the calculations. We've been spending time on visualizing the data, but sometimes we have to increase the resolution of the algorithm and see some of the complexity that emerges out of this calculation, which I think in many ways could be very beautiful. Let's start by discussing this A-star algorithm. You have to think that path finding, first of all, it's not just a problem that could be applied to grids. I know that we're actually looking at as a grid, and we have discussed that this is a problem that could be extrapolated to all different graph networks. It could be incredibly flexible for different solutions. Obviously, it could work in 3D as well. Let's look at what environments. If we think of architecture and planning, you could start thinking of route optimization, you can talk about building evacuation. If you start thinking of game design, there's beautiful games such as Tor Fortress that are very simple, like Asky graphics, but at the same time they use an incredible amount of computation of path finding where NPC have to move through the world. This is one of the first places where I would invite you to play with this algorithm in terms of like, how can you guide an agent within the world, not through just the flow of a vector, but perhaps with very specific tasks? An agent could actually go and maybe find a particular resource and bring that resource back to a particular location, and that might require path finding in multiple sequences. In many of those cases, the path finding calculation, it's invisible. It's an invisible layer. But perhaps you want to show some of this data of how the construction of a train or the construction of an environment dynamically might change the way in which these agents might behave. NPC movement in the opposite direction, you could actually think of level design. If you pre calculate paths that might be the way in which you navigate a system, you can use that to make environments that are always accessible, always available to be navigated as opposed to environments that might end up without any capacity for navigation. Within industrial design, you could find robotic path finding. How do you move from one point to another one, and what is the optimal path for that? Finally, again, out of many more examples that you can think of in transportation design, traffic flow analysis. These are a whole range of areas where they could start using some of these algorithms to take part of it. The images that I've been showing you are a little bit where we're going to be concluding with. We're going to just stylize some of the algorithm, look at it in high risk, but also start looking at the data not just numerically, but also how it's represented when we actually use it to colorize some of the tiles. Let's see the code. We're going to just continue working where we have left off. If you remember, the way in which we have to increase or decrease the resolution of the algorithm is done here. We're going to go back to a much larger grid. I'm going to comment out some of these functions here. I don't want to draw the data anymore. If you think about it, we're not even visualizing the visited tiles. We are drawing the path, we want to draw the start node, the end node, and the open stack. Those are fine, but we want to also add maybe the closed stack. Let's just see what we have so far. We have a much larger grid. We can paint. Let's invert to play with our color scheme. If we go back to our tile here, in our display function, we would say that if it's a floor, we're going to do black. This is going to be a white line. If it's a wall, it's going to be white. We're inverting the color scheme here. If you think that the stroke is too intense, you can bring this down a little bit like maybe 80. Here, we have the same system. Finally, I would like to draw one more function, which would be a very slightly different way of displaying the data. We have been displaying the data in this numeric fashion. Let's just display the data in a graphic fashion. We're going to say the def display_visual_data. Here, we're going to say that the mapped F. I'm going to create a variable that is going to be mapping the value of F, which is what we want to visualize, which is ultimately what drives the algorithm. Let's map the value of self. The mapping technique, we have been using a lot to change the domain of a variable into another one. We know that this variable might go between zero and 1,000, which is roughly the distance that you might be able to get, maybe a bit more, but we're going to just estimating it at the moment. We're going to say between zero and 1,000, that's going to be transfer into a color of 0-255. Now we could say that the color or call the variable color, it's going to be a color of the mapped F. A 2550. I'm going to use that in the red channel of this color. RGB, we're going to keep 255. These are two arbitrary colors just to give we can play with these variables later, but I'm going to use the mapped FED red channel. Let's feel the cell with the color. Let's just do a stroke. Then let's do the rectangle, which is going to be self dot position. The x self-position to y and self dot cell size and self dot cell size. We have this display visual data. Now we need to call this. We're going to call it the way we have been doing before. You see the same way we drew the stack let's find that function. It's here. Let's just copy that function, and it's call it draw closed stack, and go through the closed stack. Instead of drawing the highlighted, you see that we had a specific highlighted that used the color, we would actually use display visual data, which is a new function. We're going to be applying. This one doesn't actually have an argument. Because it uses its own mapping function to define the color itself. Let's just put it just after the stack here, self-dot. Close to. Let's see if we're running into any errors. We're not so we can see the calculation being executed. As you can see now the cells. Actually, we are overriding the path. The path should actually happen after because we are not seeing once the path is found. But we have a much larger Canvas now. I invite you to really know create a little bit of a challenge for the algorithm. Where you could actually start seeing, especially if you create pockets that are dead ends, areas that need to be searched for prior, especially with a much larger canvas, such as this one. I go back to my childhood when I could just draw little labyrinths in a page. You start thinking about how you would navigate those, and how would people navigate those, maybe trying one path or another. Notice that obviously like any of these gaps that you might play into the algorithm would very quickly make use of any exploitation that you might have. We need to make sure that you don't run out of the canvas, we seem to be having an error that if you go out of the Canvas, you will crash the algorithm. I invite you to draw a difficult environment just spend a little bit of time drawing something. That might be tricky to resolve. Then pressing as to start the algorithm, you'll see how different areas are being evaluated. But you see quite efficiently, the amount of waste that this algorithm had in certain pockets is quite small, and even with a larger terrain, it can perform very well. It does so remarkably fast. With this demonstration with this setup, we're going to leave this week here and we're going to move to the final week. We're going to start a new project. So I'll see you then.