[C#] Maze Solver

Results 1 to 15 of 15
  1. #1
    Arrogant Wizard DeathArt is offline
    MemberRank
    Mar 2007 Join Date
    StockholmLocation
    2,657Posts

    [C#] Maze Solver

    Ok, I made this a while ago, but seeing alot of C# interest, I figured some people might be interested.

    Basicly, what I've done is implemented the Breadth-first Search (BFS) algorithm along with a image-analyser to solve a given maze.

    Here's a snippet from wikipedia, explaining about the algorithm.
    Quote Originally Posted by wikipedia
    In graph theory, breadth-first search (BFS) is a graph search algorithm that begins at the root node and explores all the neighboring nodes. Then for each of those nearest nodes, it explores their unexplored neighbor nodes, and so on, until it finds the goal.
    Download/Test: http://web27190.web08.talkactive.net/archive/BFS2.exe
    - Note: Requires .NET Framework 3.x

    Screenshots:

    Test with numbers:



    Test without numbers:


    Source
    - http://www.dragons-lair.org/reposito...h-First_Search
    Last edited by DeathArt; 27-07-08 at 12:05 AM.


  2. #2
    Apprentice Sequence is offline
    MemberRank
    May 2008 Join Date
    24Posts

    Re: [C#] Maze Solver

    Just downloaded and tried it, it's really nice ;)

    If you want to extend it, then you should add a sort of project files, so it would be able to open a file and then do the BFS thing.

  3. #3
    Gamma Daevius is offline
    MemberRank
    Jun 2007 Join Date
    NetherlandsLocation
    3,252Posts

    Re: [C#] Maze Solver

    Nice one. The second image looks like one of the things I did too:
    http://www.gamedev.net/reference/art...rticle2003.asp

    This one included diagonal paths aswell, I tried to build it. It's very complicated (in C++), it sort of worked but not fully, so I'm using a library now for it...wondering which method is better or faster.

    Nice one.

  4. #4
    The World Is Yours PixelPro is offline
    MemberRank
    Jun 2007 Join Date
    UKLocation
    3,252Posts

    Re: [C#] Maze Solver

    Nice release. I think it looks good, I tried it out myself. + Damn, it requires the .NET Framework. My laptop doesn't have it installed.

  5. #5
    Arrogant Wizard DeathArt is offline
    MemberRank
    Mar 2007 Join Date
    StockholmLocation
    2,657Posts

    Re: [C#] Maze Solver

    Quote Originally Posted by Daevius View Post
    Nice one. The second image looks like one of the things I did too:
    http://www.gamedev.net/reference/art...rticle2003.asp

    This one included diagonal paths aswell, I tried to build it. It's very complicated (in C++), it sort of worked but not fully, so I'm using a library now for it...wondering which method is better or faster.

    Nice one.
    The code for diagonal paths are actually in my source, it's just commented out ;-)

  6. #6
    Proficient Member Aurora is offline
    MemberRank
    Dec 2003 Join Date
    Justice HQLocation
    195Posts

    Re: [C#] Maze Solver

    Question, isnt this just based on A*plus pathfinding ?

  7. #7
    Arrogant Wizard DeathArt is offline
    MemberRank
    Mar 2007 Join Date
    StockholmLocation
    2,657Posts

    Re: [C#] Maze Solver

    Quote Originally Posted by Bmsfx View Post
    Question, isnt this just based on A*plus pathfinding ?
    Yes, it is

    The BFS algorithm is one of the most common used in Pathfinding. Someone else been at University eh? ;-)

  8. #8
    Gamma Daevius is offline
    MemberRank
    Jun 2007 Join Date
    NetherlandsLocation
    3,252Posts

    Re: [C#] Maze Solver

    I've been doing A*...but whats the difference between A* and BFS?

  9. #9
    Arrogant Wizard DeathArt is offline
    MemberRank
    Mar 2007 Join Date
    StockholmLocation
    2,657Posts

    Re: [C#] Maze Solver

    A* is more complex, or that's actually wrong. BFS is more simple, since it's pratical a special version of A* (simplified).

    I'm not expert on the subject, and the only paper I had on pathfinding was regarding BFS.

  10. #10
    Gamma Daevius is offline
    MemberRank
    Jun 2007 Join Date
    NetherlandsLocation
    3,252Posts

    Re: [C#] Maze Solver

    I've tried to make A* in C++, took me several weeks...it _worked_, but nothing more. It took longer paths or other weird things. Really difficult to make it work good and efficient, so I took an existing library xD.

  11. #11
    Arrogant Wizard DeathArt is offline
    MemberRank
    Mar 2007 Join Date
    StockholmLocation
    2,657Posts

    Re: [C#] Maze Solver

    Took a evening to write this application :p C# is SO much easier to create things in than C++ (and I'm not reffering to UI stuff here)

  12. #12
    Proficient Member Aurora is offline
    MemberRank
    Dec 2003 Join Date
    Justice HQLocation
    195Posts

    Re: [C#] Maze Solver

    I agree, c# rox.

    I made alot of tools/game stuff/networking and emulator in C# so far, like

    Patch creator (byte comparison)
    Virtual file system (pak files) /w encryption
    Map editor
    Client software (directx)
    Packet loggers
    Network library TCP/IP

    ect ect, its just keep amazing me how much C# rox. :)

  13. #13
    Gamma Daevius is offline
    MemberRank
    Jun 2007 Join Date
    NetherlandsLocation
    3,252Posts

    Re: [C#] Maze Solver

    Quote Originally Posted by DeathArt View Post
    Took a evening to write this application :p C# is SO much easier to create things in than C++ (and I'm not reffering to UI stuff here)
    I guess BFS is easier somehow, I used classes in C++ just like in C#, so it can't be much different. All functions had logic coding, not functions that a language could replace somehow...

  14. #14
    Arrogant Wizard DeathArt is offline
    MemberRank
    Mar 2007 Join Date
    StockholmLocation
    2,657Posts

    Re: [C#] Maze Solver

    Quote Originally Posted by Daevius View Post
    I guess BFS is easier somehow, I used classes in C++ just like in C#, so it can't be much different. All functions had logic coding, not functions that a language could replace somehow...
    C++ don't have properties, nor foreach iterations.
    Not to mention, I could likely optimize it with LINQ.

    Thus C++ is much more complex to code a final solution in. Including that writing the image analyser, would take half a day, compared to about 30 lines in C# :-)

  15. #15
    Gamma Daevius is offline
    MemberRank
    Jun 2007 Join Date
    NetherlandsLocation
    3,252Posts

    Re: [C#] Maze Solver

    Hehe, yeah, maybe thats true :)



Advertisement