About the Simple Algorithm of Automatic Pathfinding

#include<stdio.h>
#define MAPX 8
#define MAPY 8
int printmap(int a[][MAPY],int x,int y)
{int i,j,m;
for(i=0;i<x;i++)
    {for(m=0;m<y;m++)
        printf("--");
    printf("\n");
    printf("|");
    for(j=0;j<y;j++)
        if(a[i][j]==0)
            printf("%c|",' ');
        else if(a[i][j]==1)
            printf("%c|",'$');
    printf("\n");
    }
return 0;
}

 void main()
 {
     int map[MAPX][MAPY]={0},x,y;
     map[2][2]=1;
  printmap(map,MAPX,MAPY);
 }

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325196490&siteId=291194637