mamonu / Astar

A* pathfinding algorithm experiments
MIT License
3 stars 6 forks source link

integrate MAZEBOT API #6

Closed mamonu closed 5 years ago

mamonu commented 5 years ago

Perhaps someone can help with integrating the github mazebot API? Ie get a maze from the api and solve it with the algorithm and return the solution through the API?

for some information on what the github MazebotAPI is have a look at:

https://github.com/mamonu/Astar/blob/master/MazebotAPI.md

Fayhen commented 5 years ago

Hi! I would be glad to help to try to integrate MazebotAPI requests in your code. First I need to know exactly what and where in your code you need data returned from the API.

My guess is that you could use a function that makes a request to MazebotAPI, which returns a grid variable containing the generated maze? Just like your current randomgrid(mazesize) function does locally, but returning the maze from MazebotAPI instead. Is that correct?

mamonu commented 5 years ago

yes. and it needs to be in a format that is like the output of randomgrid(mazesize) basically.

Fayhen commented 5 years ago

Got it working and shall be making a pull request shortly. I used Python's requests module (may require a quick install) and added a requirements.txt file, as well as a .gitgnore. I added three functions to mazebotapi.py , one which will request a maze of random size, another which will allow you to set the size of the requested maze, and one to parse the request data into a numpy array. The functions also return the start and goal coordinates, as they are set on the MazebotAPI request data.

There are just two considerations to be made:

That being said, one can just rerun the script until it works, and can see it solving a 150x150 maze like: https://drive.google.com/file/d/1HkCeqj3ZEKiZW7efnypjlfnfbhpaSmi2/view?usp=sharing https://drive.google.com/file/d/1reucjpvPtCuQOt9HZ5_JbLMFAglN9Bjw/view?usp=sharing

mamonu commented 5 years ago

very good work. well done mate