maze array

This is a discussion on maze array within the C++ Programming forums, part of the General Programming Boards category; this one piece of code has me going nutz.. I'm essentially trying to predict the next move.. everything is based ...

  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,308
    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, 08:25 PM
  2. from 2D array to 1D array
    By cfdprogrammer in forum C Programming
    Replies: 17
    Last Post: 03-24-2009, 11: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, 10:54 AM
  5. Quick question about SIGSEGV
    By Cikotic in forum C Programming
    Replies: 30
    Last Post: 07-01-2004, 08:48 PM

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