VBA – A Search Algorithm with VBA – Teil Zwei

After the article here I have started to think more over the search algorithm and I have decided to make it look better and work better. E.g., by using the fact, that the distance between the diagonals neighbours is 1.4 times more the distance of the direct neighbour tiles. This comes from the Pythagorean Theorem and could be easily proven. To speed up my code, I have decided to make it 140 and 100 instead of 1.4 and 1, because my processor is better at this kind of maths 🙂

Furthermore, I have added the possibility to generate obstacles by random and by selection. Another feature is the fact, that you may design the matrix size by your own.

And pretty much that is all so far.

Here are the screenshots (the blue cells are from selection, the greens are from random):

NoWay after

Here comes the code:

In GitHub.

The file is here – matrix reloaded – Do not download files with VBA code from the Internet! It is not safe!

That’s all 😀

Tagged with: ,