From the course: Python Data Structures and Algorithms
Unlock the full course today
Join today to access over 24,500 courses taught by industry experts.
Read a maze from a text file - Python Tutorial
From the course: Python Data Structures and Algorithms
Read a maze from a text file
- The mazes used in this course are all stored as text files with spaces representing empty cells and a symbol such as an asterisk representing an obstacle or wall. Now, if we go to our course files and we look in the folder called mazes, we've got several mazes here that you can experiment with. So let's take one for an example, there's one called modest maze dot text. So you can see, we have some asterisks and then spaces are representing empty cells. Sometimes it's quite helpful to actually go into settings at this point in pie charm and go to editor, general appearance and then show white spaces. And then you can see these tiny little dots representing the spaces. It gives you a clearer idea of how it's constructed. There's also some end of line characters that are not shown and in our code, we'll strip those. And I'll talk about those in a moment. So let's just change that setting back. So that's what our mazes look like. Here's a few different ones. There's one that we're going…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.