Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

The 20 Line Challenge / pathfinding demo

Author
Message
Daemon
18
Years of Service
User Offline
Joined: 16th Dec 2005
Location: Everywhere
Posted: 28th Oct 2006 01:09
Yes, I know people have written path finding functions. I tried to make one myself before here.
I have managed to fit pathfinding into 20 lines and it is capable of multiple paths at once. Change the "width" and "height" variables to change the width and height of the world.

Controls:
Left-click: Draw walls
Right-click: Draw beginning/end point
Enter(once drawn even number of points): begin to path find.

It will take a second to find the paths, especially with large worlds and many paths.

Also, don't make impossible situations. It doesn't check for that, so you will be stuck in a loop.

Compressed-


Uncompressed [not as good colo(u)rs]-


sadsack
20
Years of Service
User Offline
Joined: 27th Nov 2003
Location: here
Posted: 28th Oct 2006 01:27
Hi Daemon,
I like your code, it is slow, Do you mind is I email you if I find a part of it that I don't understand. I would like to make it faster.
renny
Daemon
18
Years of Service
User Offline
Joined: 16th Dec 2005
Location: Everywhere
Posted: 28th Oct 2006 02:27 Edited at: 29th Oct 2006 05:21
It would be great if you could make it faster.

If you don't understand something in it email me at:
Jake(I hate spam)Stoth(a with circle around it)yahoo(dot)hotmail(dot)com

Take out (I hate spam), put @ for (a with circle around it) and put a . for (dot)

Edit: I have updated my code, but it doesn't fit into 20 lines any more. One difference is that each path has it's own color. Also, if you hit space when drawing the world a maze will be generated, that way you don't have to take the time to draw out really complex test worlds. The width and height should both be odd numbers if you want to generate a maze.

O, and I did change how the a* function works a little.


sadsack
20
Years of Service
User Offline
Joined: 27th Nov 2003
Location: here
Posted: 30th Oct 2006 02:16
I want to work on that code, it is very good, but I just got LightWave 9 and I have to get some models out. So it will be a week or to befor I can get into it. Thanks for the ok on it.
Just email me and I will put your email in my address book

ufofinder2001@yahoo.com
rennyhampton@thegusworks.com

Login to post a reply

Server time is: 2024-04-20 07:21:17
Your offset time is: 2024-04-20 07:21:17