Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add wilson with solution helper method #160

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

luciaquirke
Copy link
Contributor

@luciaquirke luciaquirke commented Apr 8, 2023

  • Add a helper method that generates a maze using Wilson's algorithm, and a solution to it using A*. The start and ending points of the path are chosen randomly.
  • Update the name of the method to get the solution because I found it confusing - open to anything less wordy

I couldn't use this method's outputs with PlotMaze which made me realise we have a bunch of similar but incompatible types that are keeping me from using the solved maze with the PlotMaze.add_true_path. I think we may need to merge CoordTup and Coord, and replace CoordArray with list(CoordTup). Or at least be consistent with how we do it. Not necessary for this PR though.

@luciaquirke luciaquirke force-pushed the luciaq-122-wilson-solution branch 3 times, most recently from fd541c5 to 0d252fe Compare April 8, 2023 14:23
@luciaquirke
Copy link
Contributor Author

Bump :)

@mivanit mivanit mentioned this pull request Apr 17, 2023
19 tasks
Copy link
Member

@mivanit mivanit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's cleaner to have a single method to take the name of a generator and a grid shape, for when we add more generation algos. I've got an implementation of this in #177

def get_maze_with_solution(gen_name: str, grid_shape: Coord) -> SolvedMaze:
    maze: LatticeMaze = GENERATORS_MAP[gen_name](grid_shape)
    solution: CoordArray = np.array(maze.generate_random_path())
    return SolvedMaze.from_lattice_maze(lattice_maze=maze, solution=solution)

do you think its a good idea to add that to this PR? either #177 or #162 contains code to run through all generators and test them, which I think is also cleaner than testing them individually.

@mivanit mivanit self-requested a review April 20, 2023 20:06
@mivanit mivanit added the move-to-dataset-lib This PR/issue needs to be moved to the maze-dataset library label Jun 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
move-to-dataset-lib This PR/issue needs to be moved to the maze-dataset library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants