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

implementation of getNearSolution #1

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

Conversation

bastianmarin
Copy link

Good library, I was using it to generate a map in MTA:SA but I didn't know how to obtain the solution of this map, I think this could help the library. It will return the closest route to the maze.

Good library, I was using it to generate a map in MTA:SA but I didn't know how to obtain the solution of this map, I think this could help the library.
It will return the closest route to the maze.
@RiskoZoSlovenska
Copy link
Owner

Hi, thanks for the PR! There's a couple things I'd like to point out:

  • This doesn't work on mazes with more than two dimensions
  • This understands simple representation coordinates, not actual maze coordinates (i.e. {1, 1} should be the cell in the top left corner, not a "wall")
  • This doesn't validify user input
  • It would be nice if the return value was a list of directions to move in rather than a list of coordinates

Since you're implementing this function as a method of the Maze class, it'd be more efficient to use the internal Cell objects directly instead of first converting to the simple representation. By using the internal Cell objects, you'll be able to easily query all connected cells in a dimension-agnostic way, which fixes the first two issues. Additionally, the Maze class has a few methods you might find useful for validifying user input.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants