Page 1 of 3 123 LastLast
Results 1 to 10 of 23

Thread: Maze Solver - A-Star Path Finding

  1. #1

    Maze Solver - A-Star Path Finding

    Hello All,

    I've been pretty quiet lately because I've been busy learning thinBasic and how to develop a module. I now have something to show, as my first attempt. I will welcome your criticism of it, as I will learn from what you have to say. Perhaps others will learn from your comments as well.

    This is a very simple application. You draw a maze on the screen, pick starting and ending points, and let the computer try to find a path through the maze. There are some sample maze files included to get you started.

    The path-finding is accomplished using the A* (A-Star) algorithm, which is provided in a module for speed reasons. The module was coded in "C" using the DevC++ IDE.

    To install, uncompress the zip file into your thinBasic UserScripts folder, and copy the thinBasic_ASTAR.dll file to your LIB folder. The SDK folder has the source files the module was compiled from.

    I'm not a "C" programmer, so please let me know if I did something wrong in my module.

    Known Problems:

    I developed this application at home on a Windows 2000 Pro OS, I just ran it at work on XP, and it seems to act a little differently.

    I'm having problems with the fonts in the Help About dialog box. Sometimes they render correctly, othertimes they do not.

    I'm also not clear on how to handle the WM_PAINT message. I tend to get multiple repaints of the screen when I only want one.

    The module is not very well developed. If there is sufficient interest, I will develop it further and make it more useful. I'm not a game developer, so I'm not sure what you guys would want.

    Thanks for taking a look!

    Randall

    Updates:
    • 2007.10.06 main window is now resizable and mazes will adapt to winwow client area

    Attached Files Attached Files

  2. #2
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    6,796
    Blog Entries
    3
    Rep Power
    693

    Re: Maze Solver - A-Star Path Finding

    Hi Randall,

    what a shock !
    This is absolutely incredible script and module!

    Profi layout, fast execution, even helpfile !

    I will check the repaint / font problems ... but this are just details comparing to work you did.


    Terrific!,
    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 7 64bit - Intel Core 2 Duo T6600 @ 2.2GHz - 4 GB RAM - NVIDIA GeForce G210M 512MB
    Windows 8 64bit - Intel Core i5-3350P @ 3.1GHz - 8 GB RAM - NVIDIA GeForce GT640 3GB

  3. #3
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    6,796
    Blog Entries
    3
    Rep Power
    693

    Re: Maze Solver - A-Star Path Finding

    Regarding fonts,

    it seems to me like some resource leak or something.
    It should be correct to do something like
    [code=thinbasic]
    DeleteObject(hFont2)
    DeleteObject(hFont3)
    [/code]
    ... when exiting about proc. Maybe something similar for painting, but I am not very good at raw SDK paint functions, so maybe somebody else will know better

    I must play with your script again and again. Really nice !


    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 7 64bit - Intel Core 2 Duo T6600 @ 2.2GHz - 4 GB RAM - NVIDIA GeForce G210M 512MB
    Windows 8 64bit - Intel Core i5-3350P @ 3.1GHz - 8 GB RAM - NVIDIA GeForce GT640 3GB

  4. #4
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    50
    Posts
    8,187
    Blog Entries
    2
    Rep Power
    10

    Re: Maze Solver - A-Star Path Finding

    Randall,

    what a present
    Nice idea, perfect module, professional script complete and well written in all parts. You have spent a lot of time on it, I'm pretty sure about that. I have no words because you have showed to me once again the many possibilities thinBasic and especially thinBasic modules can have.

    Regarding refresh rate and some strange %WM_PAINT firing, I'm quite sure it is a problem in UI (User Interface) module. In today released thinBasic preview 1.4.0.1 I have changed some code on how internal UI Windows message pump handle %WM_PAINT message. It makes some positive difference for example with previous one version when window goes outside screen and return, covered area does not get repaint while with current online one it des. But I need some time to understand what I'm doing wrong with %WM_PAINT. So for the moment do not worry about that or at least not too much. I will use this script for testing.

    Regarding fonts, I need some more time to study your script and see how things are done.

    Thanks again for this present.
    I'm sure it will focus the attention for some big time
    Be prepared to implement thinBasic_ASTAR module

    Ciao
    Eros

    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	ASTAR.jpg 
Views:	613 
Size:	263.5 KB 
ID:	4246   Click image for larger version. 

Name:	ASTAR2.jpg 
Views:	381 
Size:	256.6 KB 
ID:	4247  
    www.thinbasic.com | www.thinbasic.com/community/ | psch.thinbasic.com
    Win10Pro 64bit - 8GB Ram - Intel i7 M620 2.67GHz - NVIDIA Quadro FX1800M 1GB

  5. #5
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    50
    Posts
    8,187
    Blog Entries
    2
    Rep Power
    10

    Re: Maze Solver - A-Star Path Finding

    Randall,

    as we are used to do for interesting complete projects like this one, I have created a dedicated forum named AStar and moved your posts into it.

    You are also moderator in this forum. Being a moderator doesn't mean anything other than you have some more forum power over posts. So feel free to do what you prefer with your new creature here.

    Ciao
    Eros
    www.thinbasic.com | www.thinbasic.com/community/ | psch.thinbasic.com
    Win10Pro 64bit - 8GB Ram - Intel i7 M620 2.67GHz - NVIDIA Quadro FX1800M 1GB

  6. #6
    thinBasic MVPs Michael Hartlef's Avatar
    Join Date
    Sep 2006
    Location
    Leverkusen, Germany
    Age
    51
    Posts
    3,278
    Blog Entries
    2
    Rep Power
    339

    Re: Maze Solver - A-Star Path Finding

    Great man! I will still release my path module, the more the better. I will have a close look at yours. Again thank you very much!
    Running Windows 7 Home, 64 bit, 8 GB ram, Athlon II X2 255, ATI Radeon HD 4200.

  7. #7

    Re: Maze Solver - A-Star Path Finding

    Excellent looking program Randall, really interesting.
    Operating System: Windows 10 Home 64-bit
    CPU: AMD C-70 APU 40nm Technology
    Memory: 4.00GB DDR3 @ 533MHz
    Graphics: 256MB ATI AMD Radeon HD 7290 Graphics

  8. #8
    thinBasic MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Location
    Naples, Florida & Duluth, Georgia
    Age
    61
    Posts
    3,869
    Rep Power
    398

    Re: Maze Solver - A-Star Path Finding

    Randall, I am just amazeD

    It is so quick and clever. I couldn't fool it yet, probably won't but I will keep trying. Very cool idea for a game and also of course what looks like a neat module to study!!
    THanks so much!! Really really neat!!!
    Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
    Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server

  9. #9

    Re: Maze Solver - A-Star Path Finding

    Thank you all so very much for your kind comments!

    I was only able to create it because of all the sample code and forum posts you all have so graciously supplied. Anytime I wasn't sure how to code something, I could either find a sample program or code snippet in the forums that showed me the way. My thanks go out to all of you for unselfishly sharing your code and expertise. I am honored to add my code alongside the excellent code already posted on this forum site.

    Thanks again,

    Randall

  10. #10

    Re: Maze Solver - A-Star Path Finding

    Quote Originally Posted by Michael Hartlef
    Great man! I will still release my path module, the more the better. I will have a close look at yours. Again thank you very much!
    Thanks Michael,

    If you would like to incorporate my code into your path module, please feel free to do so.

    Randall

Page 1 of 3 123 LastLast

Similar Threads

  1. Maze Solver - Updated Version 06 Oct 07
    By Randall in forum AStar - (A Star) path-finding algorithm
    Replies: 13
    Last Post: 07-10-2007, 16:01

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •