关于自动寻路简单算法

#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);
 }

猜你喜欢

转载自www.cnblogs.com/chengtou/p/8983238.html