Skip to content

implementation of getNearSolution#1

Draft
iiroak wants to merge 1 commit into
RiskoZS:masterfrom
iiroak:master
Draft

implementation of getNearSolution#1
iiroak wants to merge 1 commit into
RiskoZS:masterfrom
iiroak:master

Conversation

@iiroak

@iiroak iiroak commented Mar 6, 2024

Copy link
Copy Markdown

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.
@RiskoZS

RiskoZS commented Mar 6, 2024

Copy link
Copy Markdown
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.

@RiskoZS RiskoZS marked this pull request as draft August 9, 2025 01:58
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