From the course: Python Data Structures and Algorithms

Navigate the GUI

- [Instructor] In the last video, we looked at the game mode of the GUI. In this video, we're going to look at the explore mode. So I'm going to close off maze_gui_game.py and instead open up maze_gui_explore.py. And I'm also going to go into configure and select a different maze. So the way you do that is you comment out the one that you don't want, and then the one that you do want, you can select, and let's do diagonal 23 by 23. I'm using the keyboard shortcut there, control forward slash. You could, in principle, just do it by deleting the pound sign but that's a little bit more once you know the keyboard shortcut. So we've now selected a different maze file. Now if I was to do control F 10 from this file, it would actually treat this as the entry point for the project, and we're trying to run this file, which wouldn't do much. So if you're going to do control F 10, you want to do it from your main file, so control F 10. Now the way this works is I can click to place my treasure in my maze. Okay so, once I've clicked, I then press S, and the opponent will use whichever algorithm is selected to try and find that treasure. So this is using DFS. Okay, and the treasure is found. So let's reset and do that again, and I just want to show you what path does as well because I haven't mentioned that yet. So we can press S to start, and then if I press path, then the path is not displayed. So there's no trail left, but I can turn it back on, and that's how that works. So depth first search is not getting there particularly quickly. (chuckles) Just missed it. Okay, and you'll understand better why it's taking the particular path that it's taking once we've looked at how the algorithm works in detail. Now let's do the same with breadth first search. So I've placed my treasure, and then press S, and you get a very different type of search band. And finally, let's look at A star. So if we put the treasure position to last time but we use A star, you'll see that A star got there in a much more efficient way. So how you find this GUI both fun to use and a useful aid in learning about the data structures and algorithms taught in this course. If any point, you're having trouble the kind of high level, conceptual understanding of these algorithms, those three, depth first search, breadth first search, and A star, then, by all means come back and play around with the GUI just to kind of develop that more intuitive high level understanding if you're getting bogged down in the details.

Contents