int bombX[10]; //將這些設成全域變數,方便後面作業
int bombY[10];
int game_continue=1;
char display[9][9];
int bomb_count[9][9];
int truth[9][9]={0};
int near[8][2]={-1,0,-1,-1,0,-1,1,-1,1,0,1,1,0,1,-1,1};
void refresh_display(void);
void mapreal(void);
void maptruth(void);
void whattodo(void);
int sum_near(int x,int y);
void open(int x,int y);
int main(void) //開頭的操作,剩下的使用自己寫的函數
{
int i;
int j;
int x;
int y;
char ch;
srand(time(NULL)); //用時間選取一組亂數組
for(i=0;i<9;i++)
{
for(j=0;j<9;j++)
display[j]='*';
}
refresh_display();
while(1)
{
int a,b;
printf("please enter bomb number\n");
scanf("bombX[%d] bombY[%d]" ,&a,&b );
printf("Please open a square (x,y) where x=0~8,y=0~8\n");
printf("x,y=");
scanf(" %d , %d",&x,&y);
while(x<0||x>8||y<0||y>8) //使用者介面
{
printf("Please input again!\n");
scanf(" %d %d",&x,&y);
}