For simplicity, we will define what exactly a maze entails. It is a rectangular grid that is either a wall or a pathway in each position. For maze files, we will mark a wall as a * and a pathway as a space (an example). Further requirements for a maze is that the exterior of the maze is completely walled except for one opening on the left side that is the entrance and one opening on the right side that serves as the exit.

Maze 1.0

  • Create a program that will read maze files such as this and store it into a 2D list that serves as a grid. You may choose to keep the */space notation of the file format or store some other values in the list to mark walls and paths.
  • Add the capability to print the maze to the screen using the data from the list (not just aping the file contents to the screen). This print functionality should be contained in a function that takes the maze data (your list) as the sole parameter.

Maze 2.0

  • Write a function that locates the entrance of the maze and marks that spot in the maze list as the position of the player. Another symbol will have to represent the player, for example X or whatever you prefer. This function should be called immediately after the maze is loaded.
  • Edit the program so that it is displayed in a PyGame window rather than as console output. This will most likely require quite a bit of additions and changes to your program, but your maze list represenation should not need to be altered. Your drawing code should use this list to determine what to draw to the screen.

Maze 3.0

  • Change the program so that there is a Maze class that holds the 2D list as member data and the file reading occurs in a member method that is called from the constructor. Have the print maze function become a member method also.
  • Alter the program so that it takes user input to move through the maze.

Maze 4.0

  • Using maze files is a bit cumbersome and boring, so alter program so it does not load a maze file at start, but uses a maze generator to create a random maze at each load.
  • If you have not already, give some sort of on screen congratulations for finishing the maze.
  • Bonus: Create another function that will solve the puzzle for the player from wherever they are located and display the solution. Hint: Read up on depth-first search.