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 Support for Wall Follower Algorithm #2

Open
ThomasThelen opened this issue Nov 11, 2017 · 2 comments
Open

Add Support for Wall Follower Algorithm #2

ThomasThelen opened this issue Nov 11, 2017 · 2 comments

Comments

@ThomasThelen
Copy link
Contributor

ThomasThelen commented Nov 11, 2017

It would be very nice to support the wall follower algorithm. We can go about this a couple of different ways.

Add another solve method.

We would rename def solve_maze to something like def solve_recursive_back and then add a new method, def solve_wall_follower.

Pros:
It keeps the code simple
Quick
Few auxiliary changes (for example, we may need to refactor def _validate_neighbors_solve

Cons
In the long run, the code may get incredibly unstructured if we support more.

Create a solver Class

Create a base class that represents a solution method.

For example,

class Solver
{
public: 
virtual MAZE solve();
}

class WallFollower : Solver
{
 MAZE solve();
}

class RecursiveBacktracer : Solver
{
   MAZE solve();
}

etc
etc

We could always create an interface to it at a later time so that users don't need to mess around with class instantiation.

Pros:
Better long term support

Cons:
Adds complexity
Not as easy to use?

Options:

  1. Don't support the algorithm
  2. Add a new method for it
  3. Create the class system
@jostbr
Copy link
Owner

jostbr commented Nov 13, 2017

Thanks for all your suggestions and contributions! Yes, initially I didn't think of including more algorithms so I just had everything maze stuff in the Maze class, but yes, creating a solver class might definitely be a good way to go. Also the wall follower algorithm sounds like a good addition.

@jostbr
Copy link
Owner

jostbr commented Nov 13, 2017

Also, I very recently added support for a breadth-first search solver as well as a (yet not fully functioning) bidirectional depth-first solver.

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

No branches or pull requests

2 participants