For a school project I have to write a Python program which generates random maze. The maze should be perfect (there is only one path from the entrance to the exit).
I am new to Python so I am trying to figure out which skills I need to acquire to complete this assignment.
Would you be able to tell me which modules of the Python course[1], or which Python courses of the Catalogue, I could cover to develop the skills I need to write this maze program.
I know I probably need to cover:
the “Python Basics” module, surely
the “OOP” module
the “Classes and objects” module
"Dictionay and Set”?
I also know I need to know “Python environment” and to be able to open/read/close files as well as import.
the hardest part will not be the python syntax, it will be writing the algorithm to create the maze
the python course could be a good start, now I am not aware if the catalogue has a course on how to work with files, but that would be the other thing you need to learn that is not included in the Python course
Indeed, as @ILM said, Python files managing is not included in the lessons (because all chalenges proposes a built-in editor, but it will not help you). If you are totally new to Python (you didn’t print hello world yet), it would surely be nice to cover Python Basics. The OOP module works with the Classes and Objects module. Here’s a citation from the first lesson that define it pretty clearly:
Object-oriented programming, also known as OOP, is a programming style in which developers treat everything in their code like a real-world object.
A class is like a blueprint for creating objects. Every single object created from a class has attributes that define data and methods that define the behaviors of the objects.
Dictionaries and Set are some ways to store linked values. A dictionary stores a key associated with it’s value. On the other hand, a set is an unordered list that cannot be changed.
To generate a random maze, you will have to cover the Algorithm part I think, but you might need to use some libraries (I don’t really know, these are just hypotheses). Of course, it depends on the size of the labyrinth, the display support, etc.
With an advanced level of Python you could use the following modules: pyamaze, labyrinth-py, Matplotlib, NumPy, and Pygame Zero.
Since this is for a school project, you’re not expected to spend time learning intermediate to advanced level Python.
Start with what you already know. Try and build a basic maze using C. This may help you discover which data types to use, and how to structure code for generating a random maze. Then learn the basics of Python.
You may want to consider generating mazes of different sizes and shapes.
The freeCodeCamp curriculum for learning Python basics uses a console in the browser. You may need to read a few articles on how to setup a Python environment. Click on “Visit the Curriculum” at the top of the forum page and type “how to install Python” in the search field of the page that loads.