Skip to content

lantingchiang/CIS191-final-project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 

Repository files navigation

CIS191-final-project

Installation

Download maze_solver.py and graph.py into the same directory. Install required packages (argparse, turtle, tkinter, random, time) using your system's package manager

Execution

On Linux:

./maze_solver.py [src_x] [src_y] [tgt_x] [tgt_y] [maze_ith_row]...

On Mac:

python3 maze_solver.py [src_x] [src_y] [tgt_x] [tgt_y] [maze_ith_row]...

  • src_x: the x coordinate of the starting point
  • src_y: the y coordinate of the starting point
  • tgt_x: the x coordinate of the end point
  • tgt_y: the y coordinate of the end point
  • maze_ith_row: the ith row of the maze, represented by a string of 0's (empty cells) and 1's (blocked cells)
Note:
  • the upper left hand corner of the maze corresponds to coordinate (0, 0)
  • each row in the maze has to be of the same length
  • all inputs are required
  • To see help message:
  • On Linux: ./maze_solver.py -h
  • On Mac: python3 maze_solver.py -h

Description

A maze can be described as a two by two grid of blocked cells and empty cells with a starting point and an end point. We take in this information and parse it using the argparse package. We first convert the read in rows of the maze into a 2d array, then construct a graph with nodes representing cells and edges representing valid paths between cells. We then run a breadth first search on the graph to solve the maze, outputting coordinates along the path from the starting point to the end point. We use turtle to draw out the maze and animate the solution path. A random maze of the same dimensions is generated and drawn out 5 seconds after drawing out the solution of the input maze.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages