Thread: Represent Maze

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Apr 2010
    Posts
    50
    Quote Originally Posted by MK27 View Post
    Sure, but a graph node (for a 2D maze) looks (something) like this:
    Code:
    struct node {
        int ID;  // not necessary
        struct node *north;
        struct node *south;
        struct node *east;
        struct node *west;
    }
    It already contains a list of adjacent nodes.

    Also, you need all the nodes, not just the decision points, or the "decision points" will have no relation.
    Why there will be no relation. The decision points will be connected with an edge and the edge will have a weight equal to the no of squares in between.

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Quote Originally Posted by iamnew View Post
    Why there will be no relation. The decision points will be connected with an edge and the edge will have a weight equal to the no of squares in between.
    How do you know what the "right" decision points are until you solve the maze? If you're going by the unsolved version, every square is then a "decision point".

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Solving A Maze Using C Language!!!!
    By jonnybgood in forum C Programming
    Replies: 6
    Last Post: 11-08-2005, 12:15 PM
  2. Q: Recursion to find all paths of a maze
    By reti in forum C Programming
    Replies: 7
    Last Post: 11-26-2002, 09:28 AM
  3. My Maze Game --- A Few Questions
    By TechWins in forum Game Programming
    Replies: 18
    Last Post: 04-24-2002, 11:00 PM
  4. Algorithm to walk through a maze.
    By Nutshell in forum C Programming
    Replies: 30
    Last Post: 01-21-2002, 01:54 AM
  5. Maze game, complete with maze editor and an example maze!
    By Brian in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 01-20-2002, 03:27 AM