Solving a Maze in C++. URGENT Help Needed :)
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: Solving a Maze in C++. URGENT Help Needed :)

  1. #1
    Join Date
    Jun 2011
    Posts
    1

    Post Solving a Maze in C++. URGENT Help Needed :)

    Hi guys !
    I'm new on your forum but I'm not new to programming.
    I'm in collage and I need to write a program in C (actually using some of C++ features, but no OOP - just OP).
    The program loads MAZE features (starting point, finish point, "walls") from a file, and it shoes the SOLUTION.
    • Without using recursion
    • using directions {{0,1} {1,0} {-1,0} {0,-1}}
    • saving the current way (probably best saving it to another board)
    • no OOP, OP only (using C++ read/write/file handling functions)


    THIS IS REALLY URGENT, I don't hace much time but if one of you guys already has a similar solution, it will be a great help for me.
    I can not afford failing this one .. that's really important for me.

    Thanks again,
    Eli

  2. #2
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,228

    Re: Solving a Maze in C++. URGENT Help Needed :)

    Those of us that can help you are in a position to do so because we did our own homework. You'll need to show that you've made an effort before anybody here will help you.

  3. #3
    Join Date
    Jul 2002
    Location
    Portsmouth. United Kingdom
    Posts
    2,725

    Re: Solving a Maze in C++. URGENT Help Needed :)

    Have you been given a maze solving algorithm?
    "It doesn't matter how beautiful your theory is, it doesn't matter how smart you are. If it doesn't agree with experiment, it's wrong."
    Richard P. Feynman

  4. #4
    Join Date
    Sep 2004
    Location
    Holland (land of the dope)
    Posts
    4,123

    Re: Solving a Maze in C++. URGENT Help Needed :)


  5. #5
    Join Date
    May 2009
    Location
    Boston
    Posts
    265

    Re: Solving a Maze in C++. URGENT Help Needed :)

    If you think of a maze as a graph, where the the open intersections of the maze are a vertex, and each corridor is an edge connecting two verticies, then you are looking for the path that connects the vertex at the maze entrance vertex and the maze exit vertex.

    Most search functions are recursive, so you may want to look at older pathfinder or depth first searches in Fortran 77, since that language didn't support recursion. I would write it out in pseudo code so you can see what you need the algorithm to do. You need to begin by loading the maze into a data structure. I think some kind of connection table would be best, but it's hard to know without seeing the form the maze is currently in. After you have a data structure for the possible paths, then you can start to look at the best way to navigate.

    LMHmedchem

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center