Thread: maze array

  1. #1
    Registered User
    Join Date
    Nov 2007
    Posts
    27

    maze array

    this one piece of code has me going nutz.. I'm essentially trying to predict the next move..

    everything is based in columns and rows for a 2 dimensional array.. do I define the current positon to the possible future position. the program later checks to make sure the position is acceptable then print the maze etc.. bolded area is the part where I'm stuck.


    Code:
    const int ROW_SIZE = 20, COL_SIZE = 17; 
    void printMaze(char [][COL_SIZE], char *, char);
    bool isMoveLegal(char );
    
    int _tmain(int argc, _TCHAR* argv[])
    {
       char board[ROW_SIZE][COL_SIZE] = maze text here..
      
        char *position;
        position = &board[1][1];
        char symbol='^';
        
        while (!GetAsyncKeyState(VK_ESCAPE) && *position != 'X')
        {
            printMaze(board, position, symbol);
            char *nextPosition = position;
    
            
            if (GetAsyncKeyState(VK_UP))
            {
    		symbol = '^';
    // not complete need to update 
    	           
            }
            else if (GetAsyncKeyState(VK_DOWN))
            {
    	etc........etc.. etc............

  2. #2
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,318
    Quote Originally Posted by DJPlayer View Post
    everything is based in columns and rows for a 2 dimensional array.. do I define the current positon to the possible future position. the program later checks to make sure the position is acceptable then print the maze etc.. bolded area is the part where I'm stuck.
    We have no way of knowing in what way you are stuck and as such cannot help you at this stage.
    You're best bet is to post some code that does the wrong thing and say what it does wrong, and what you'd like it to do.

    Make sure you ask an actual question. Asking a question can be the difference between a rant and a request for help.
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 16
    Last Post: 05-29-2009, 07:25 PM
  2. from 2D array to 1D array
    By cfdprogrammer in forum C Programming
    Replies: 17
    Last Post: 03-24-2009, 10:33 AM
  3. Replies: 6
    Last Post: 11-09-2006, 03:28 AM
  4. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM
  5. Quick question about SIGSEGV
    By Cikotic in forum C Programming
    Replies: 30
    Last Post: 07-01-2004, 07:48 PM