No AI Generated Content
Implementing a Maze Generator and Solver in Python using Jupyter Notebook
Get Free Samples Written by our Top-Notch Subject Expert Writers known for providing the Best Assignment Help Services in Australia
The given program has been implemented in python programming language using the software tool called Jupyter Notebook. Python is a high-level programming language that has a very simple syntax and it is similar to other high-level programming languages like Java. Python was initially used in the year 1991 and ever since it has grown into a very popular programming language. There are various versions of Python like Python 0.9.0, Python 2, and Python 3. Python 0.9.0 is the oldest version of python while Python 2 was introduced in the year 2000. Python 3 was introduced in 2008 while Python 2 was stopped from being used in the year 2020.
Result and implementation
The software tool that has been used to implement the program in the python programming language is called Jupyter Notebook. Jupyter Notebook is software that is freely available and it is open source and it enables programming in python (Wainer and Xavier, 2018). Codes that have python programming, visualizations, and equations can be written in the editor of Jupyter Notebook and it has a very simple interface because of which Jupyter Notebook is one of the most popular python programming software tools used in recent times. Any programmer can easily run codes in Jupyter Notebook and obtain the outputs (Alzahrani et al. 2018). The program files in Jupyter Notebook can be saved as .ipynb file or .py file. Jupyter Notebook supports most of the python libraries like Numpy and Pandas and seaborn which are used for implementing machine learning algorithms.
There are a few libraries that have been used for implementing this program in the software platform Jupyter Notebook and they include the library called pyamaze. For generating the maze in a random manner and implementing different search algorithms in the maze, the module pyamaze proves to be very useful. Pyamaze helps in creating random mazes and using various search algorithms on the maze. The GUI is produced automatically when the pyamaze module is run in the program (Gaddis, 2021). The GUI framework that is used by this module is called Tkinter and it is already present in python.
Figure 1: Pyamaze module
(Source: Obtained from Jupyter Notebook)
The variable ‘m’ stores the results returned by the maze() function and the code m.CreateMaze and m.run and executed (Linge and Langtangen, 2020). The variable m stores the value returned by maze(20,20) and then CreateMaze function is run. The variable 'a', stores the value returned by the function called agent () (Swenson et al. 2018). Then the function run is invoked and the function TracePath() is used.
Figure 2: Printing maze
(Source: Acquired from Jupyter Notebook)
A function has been written to read the txt files using the readlines() function and in this case, the filename has been read as mazeFile=open(filename, "r").
Figure 3: Maze Created
(Source: Retrieved from Jupyter Notebook)
According to the above figure, the maze has been created with the help of the code and the maze has been produced as a GUI alongside the program.
Conclusion
Python is a modern object-oriented programming language that is used for programming and coding complex tasks using variables, libraries, functions, and modules. However, the maze have been created by the help of Python programming. The user has utilized Jupyter Notebook platform to perform the respective task.
References
- Alzahrani, N., Vahid, F., Edgcomb, A., Nguyen, K. and Lysecky, R., 2018, February. Python Versus C++ An Analysis of Student Struggle on Small Coding Exercises in Introductory Programming Courses. In Proceedings of the 49th ACM Technical Symposium on Computer Science Education (pp. 86-91).
- Gaddis, T., 2021. Starting Out with Python (No REVEL or MyLab Programming).
- Linge, S. and Langtangen, H.P., 2020. Programming for Computations-Python: A Gentle Introduction to Numerical Simulations with Python 3.6 (p. 332). Springer Nature.
- Swenson, D.W., Prinz, J.H., Noe, F., Chodera, J.D. and Bolhuis, P.G., 2018. OpenPathSampling: a Python framework for path sampling simulations. 2. Building and customizing path ensembles and sample schemes. Journal of Chemical Theory and Computation, 15(2), pp.837-856.
- Wainer, J. and Xavier, E.C., 2018. A controlled experiment on Python vs C for an introductory programming course: Students’ outcomes. ACM Transactions on Computing Education (TOCE), 18(3), pp.1-16.