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

maze generation in python visuals #13

Open
Roel1988 opened this issue Mar 9, 2017 · 2 comments
Open

maze generation in python visuals #13

Roel1988 opened this issue Mar 9, 2017 · 2 comments

Comments

@Roel1988
Copy link

Roel1988 commented Mar 9, 2017

Hi Mike, I have a question regarding visualization in python of your maze generation with a* start algoritm.
Is there a way to visualize the maze being solved in real time (i.e. show the grid with the openset and the close set)?

I worked something out using graphics.py and in the past I used pygame. However somehow it was very taxing on the process.'

What package do you recon is best to use for real time visualisation in python?

Greetings Roel

@mikepound
Copy link
Owner

mikepound commented Mar 22, 2017

Hi Roel,

Sorry for the slow reply - much work to be getting on with! I don't see why you couldn't do this, essentially you'd have to have the solve function report back some information each iteration. E.g. currently explored nodes, nodes in the queue, etc. The code to visualise is a bit simple in my implementation, so it only copies the original image, then draws over the path as a list of points. Doing that every iteration would be quite slow.

OpenCV has some pretty good gui stuff, and works nicely in python. Doing this efficiently will involve holding onto information from the previous frame, so that you can "undo" the last render before drawing on the next one. A simple first implementation could just create the image from scratch each time. You may not need to run in real time, as that'd be too quick to see anyway, so you could just output to a file and then turn the images into a video at the end.

Mike

@Roel1988
Copy link
Author

Hi Mike,
sorry for my late reply as well. Many thanks for your answer.
As I am not a skilled programmer it took me a while to illustrate my point.
I just did a very simple implementation of the algo you showed. However my visualisation is getting slower with every iteration.
Probably my lack of understanding python graphics. Keep up the good work and videos'

Best Regards,

Roel
AStar_temp.py.txt
graphics.py.txt

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

No branches or pull requests

2 participants