how to start

This is a discussion on how to start within the C++ Programming forums, part of the General Programming Boards category; hi all, i have to write a maze program using stack and tree structure but i don't know how to ...

  1. #1
    Unregistered
    Guest

    how to start

    hi all,

    i have to write a maze program using stack and tree structure but i don't know how to start coding this?
    can anyone tell me how to start?

    thank you very much!!

  2. #2
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145

    Irony...

    Start with this:

    int main()
    {

    ...

    return 0;
    }










    Just joking... Sorry, I don't know anything about stacks
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  3. #3
    William
    Guest
    What's the stack got to do with it??? If you want to write a program that gets you out of a maze, then you'll need a tree structure. For that I gave an example further down (it was about 1-3 trees). Once you've programmed your Tree/Node classes you use your tree to explore each path in the maze. If you do a width first search you'll find the shortest way out!!! This is done qute easely. You represent the maze by an integer matrix. You say 1 is a wall and 2 is where you've already been. You have four options (ie each node will have maximum 4 direct kids) up,down,left and right. A branch ends when either it its a wall (1) or it hits your path (2). You're out when the current position in a Node is equal to the exit.
    All AI books treat this example. Come back if you need more help.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Data Structure Eror
    By prominababy in forum C Programming
    Replies: 3
    Last Post: 01-06-2009, 08:35 AM
  2. Adventures in labyrinth generation.
    By guesst in forum Game Programming
    Replies: 8
    Last Post: 10-12-2008, 01:30 PM
  3. C++ gui for windows where to start
    By prixone in forum Windows Programming
    Replies: 2
    Last Post: 12-16-2006, 10:48 PM
  4. GNOME Desktop won't start (Mandriva)
    By psychopath in forum Tech Board
    Replies: 10
    Last Post: 07-19-2006, 01:21 PM
  5. Start bar color in WinXP
    By confuted in forum Tech Board
    Replies: 4
    Last Post: 05-03-2003, 06:18 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21