Thread: Maze Solving Cont....PLZ

  1. #31
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    Walls are 1's.

    I've looked into my code and my structure is like this:


    Code:
    #define NORTH_WALL 0x01
    #define WEST_WALL 0x02
    #define EAST_WALL 0x04
    #define SOUTH_WALL 0x08
    #define ALL_WALL (NORTH_WALL | WEST_WALL | EAST_WALL | SOUTH_WALL)
    
    struct MazeCelll
    {
      DWORD CellInfo;
      DWORD Row;
      DWORD Col;
    };
    Init the maze for all cells to have ALL_WALL as their cell info. Now when you move north out of the current cell (if it's empty and passes the tests I mentioned above) then simply remove the north wall from the cell before you move to the next cell. The process is the same for all other directions.

    Code:
    Maze[offset].CellInfo-=NORTH_WALL;
    Then when you draw the maze you just look at cell info and use bit masks to determine which walls are 'up' and which are 'down'.
    Last edited by VirtualAce; 11-12-2005 at 12:25 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Solving maze using rec'
    By gavra in forum C Programming
    Replies: 14
    Last Post: 07-13-2008, 09:20 AM
  2. Having trouble solving maze.
    By eurus in forum C Programming
    Replies: 3
    Last Post: 02-17-2006, 01:52 AM
  3. Solving A Maze Using C Language!!!!
    By jonnybgood in forum C Programming
    Replies: 6
    Last Post: 11-08-2005, 12:15 PM
  4. 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
  5. My Maze Game --- A Few Questions
    By TechWins in forum Game Programming
    Replies: 18
    Last Post: 04-24-2002, 11:00 PM