yunai1989cool wrote:
> I just can not understand the backdate arithmeticfor example:can you give me 
> some tips: #include<stdio.h>void search(int row,int column);/*function 
> antetype*/
> int check(int i,int j,int k,int a[][12]);char 
> labyrinth[12][12]={{'#','#','#','#','#','#','#','#','#','#','#','#'},{'#','.','.','.','#','.','.','.','.','.','.','#'},
>  
> {'.','.','#','.','#','.','#','#','#','#','.','#'},{'#','#','#','.','#','.','.','.','.','#','.','#'},{'#','.','.','.','.','#','#','#','.','#','.','.'},
>  
> {'#','#','#','#','.','#','.','#','.','#','.','#'},{'#','.','.','#','.','#','.','#','.','#','.','#'},{'#','#','.','#','.','#','.','#','.','#','.','#'},
>  
> {'#','.','.','.','.','.','.','.','.','#','.','#'},{'#','#','#','#','#','#','.','#','#','#','.','#'},{'#','.','.','.','.','.','.','#','.','.','.','#'},
>  {'#','#','#','#','#','#','#','#','#','#','#','#'}};int fx[4]={1,-1,0,0};
> int fy[4]={0,0,1,-1};
> int main()/*begin main*/
> { search(2,0); return 0;}/*end main*/ 
> void search(int row,int column)
> { int i;/*caculation on the row*/
>  int j;/*caculation on the column*/
>  int newrow;/*new row coordinate*/
>  int newcolumn;/*new column coordinate*/
>  int a[12][12]={0};
>  int k; for(i=0;i<=11;i++){
>   for(j=0;j<=11;j++){
>    if(labyrinth[i][j]=='#'){
>     a[i][j]=1;
>    }
>   }
>  } for(k=0;k<=3;k++){
>   if(check(row,column,k,a)==1){
>    newrow=i+fx[k];
>    newcolumn=j+fy[k];
>    labyrinth[newrow][newcolumn]=3;
>    if(newrow==4&&newcolumn==11){
>     for(i=0;i<=11;i++){
>      for(j=0;j<=11;j++){
>       printf("%d",a[i][j]);
>      }
>      printf("\n");
>     }
>    }
>    else{
>     search(newrow,newcolumn);
>    }
>   }
>   a[row][column]=0;
>  }
> }int check(int i,int j,int k,int a[][12]){ int judgement=1; i=i+fx[i];
>  j=j+fy[j]; if(i<=0||i>=8||j<=0||j>=8){
>   judgement=0;
>  }
>  else{
>   if(a[i][j]!=0){
>    judgement=0;
>   }
>  } return judgement;}
>    
> --
> ŬÁ¦  ÎÒ²»ÏëÈñðÈËÐ¡ÇÆÎÒ    ¼ÇסŶ....

"backdate arithmetic" means nothing to me or Google.  Perhaps you are 
using the wrong terminology.  Based on the source code, it looks like 
you are attempting a search-space problem of some sort involving 
_backtracking_.  However, your mail client has mangled the source code 
and I'm not sure what exactly you want to do.

Based on your other e-mails so far, I'm fairly certain you don't know 
the meaning of the word "arithmetic" either.  Pretty sure the word you 
are looking for is "algorithm".  As in "backtracking algorithm" - for 
which a Google search turns up a Wikipedia entry as the first link:

http://en.wikipedia.org/wiki/Backtracking

However, if the search space problem you are attempting to do is what I 
think it is (i.e. shortest path maze traversal), backtracking is 
probably the _worst_ approach because you have to traverse ALL paths to 
find the shortest one.  An easier (and usually faster) approach is to 
treat the maze entrance point as the spot where you put a hose in and 
start filling the maze with water.  The water will span out in all 
directions and eventually find the exit.  The moment it does, that 
becomes the shortest path out of the maze.  There is also a pretty good 
chance that not all of the maze will have been filled and you completely 
avoid things like "splits and merges" (paths that deviate from the 
current path but then merge back in later).

-- 
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

*NEW* MyTaskFocus 1.1
Get on task.  Stay on task.

http://www.CubicleSoft.com/MyTaskFocus/

Reply via email to