#include"stdio.h"
#include"stdlib.h"
#include"windows.h"
void printnow(char a[10][11])
{int i=0,j;
while(i<10)
{j=0;
while(j<11)
{printf("%2c",a[i][j]);
j++;}
printf("\n");
i++;}
}
void sxzy(char a[10][11],int *m,int *n,int *w)
{
switch(*w)
{
case 2:a[*m+1][*n]='.';a[*m+2][*n]='*';break;
case 4:a[*m][*n-1]='.';a[*m][*n-2]='*';break;
case 6:a[*m][*n+1]='.';a[*m][*n+2]='*';break;
case 8:a[*m-1][*n]='.';a[*m-2][*n]='*';break;
}
}
int check_fan_wei(int m,int n)
{if(m>0 && m<=10 && n>0 && n<=11)
return 1;
else
return 0;
}
int pd_del(char a[][11],int *m,int *n,int *w)
{int i=0,flag=0;
if((check_fan_wei(*m,*n)) && (!(a[*m][*n]=='*' && ((a[*m][*n]==a[*m+1][*n] && a[*m][*n]!=a[*m+2][*n]) || (a[*m][*n]==a[*m][*n+1] && a[*m][*n]!=a[*m][*n+2]) || (a[*m][*n]==a[*m-1][*n] && a[*m][*n]!=a[*m-2][*n]) || (a[*m][*n]==a[*m][*n-1] && a[*m][*n]!=a[*m][*n-2])))))
{printf("åä¸èµ°!!\n");
Sleep(1000);
}
if(a[*m][*n]=='*' && ((a[*m][*n]==a[*m+1][*n] && a[*m][*n]!=a[*m+2][*n]) || (a[*m][*n]==a[*m][*n+1] && a[*m][*n]!=a[*m][*n+2]) || (a[*m][*n]==a[*m-1][*n] && a[*m][*n]!=a[*m-2][*n]) || (a[*m][*n]==a[*m][*n-1] && a[*m][*n]!=a[*m][*n-2])))
{a[*m][*n]='.';
printnow(a);
printf("\n");
while(i<1)
{printf("left 4\nright 6\nup 8\ndown 2\n");
scanf("%d",w);
if(*w!=2 && *w!=4 && *w!=6 && *w!=8)
{printf("éæ°è¾å
¥!\n");
continue;
}
switch(*w)
{
case 2:if(!(a[*m][*n]=='.' && a[*m+1][*n]=='*' && a[*m+2][*n]=='.')){printf("éæ°è¾å
¥!\n");i--;}break;
case 4:if(!(a[*m][*n]=='.' && a[*m][*n-1]=='*' && a[*m][*n-2]=='.')){printf("éæ°è¾å
¥!\n");i--;}break;
case 6:if(!(a[*m][*n]=='.' && a[*m][*n+1]=='*' && a[*m][*n+2]=='.')){printf("éæ°è¾å
¥!\n");i--;}break;
case 8:if(!(a[*m][*n]=='.' && a[*m-1][*n]=='*' && a[*m-2][*n]=='.')){printf("éæ°è¾å
¥!\n");i--;}break;
}
i++;}
flag=1;
}
return(flag);
}
void pj(int q)
{switch(q)
{
case 1:printf("perfect!!!\n");Sleep(1000);break;
case 2:printf("very good!!!\n");Sleep(1000);break;
case 3:printf("good!!!\n");Sleep(1000);break;
case 4:printf("not good....\n");Sleep(1000);break;
default:printf("bad..........\n");Sleep(1000);break;
}
}
int count_to_x(char a[10][11])
{int count=0,i,j;
for(i=0;i<10;i++)
{
for(j=0;j<10;j++)
{if(a[i][j]='*')
count++;
}
}
return(count);
}
int pd_count(char a[10][11])
{int i,j,flag=0;
for(i=0;i<10;i++)
{for(j=0;j<10;j++)
{if(a[i][j]=='*' &&((a[i][j]==a[i+1][j] && a[i][j]!=a[i+2][j] && a[i+2][j]=='.') ||(a[i][j]==a[i-1][j] && a[i][j]!=a[i-2][j] && a[i-2][j]=='.') ||(a[i][j]==a[i][j+1] && a[i][j]!=a[i][j+2] && a[i][j+2]=='.')||(a[i][j]==a[i][j-1] && a[i][j]!=a[i][j-2] && a[i][j-2]=='.')))
{
flag=1;
return(flag);
}
}
}
return(flag);
}
追é®è°¢è°¢
ä¸è¿ï¼æç°å¨æ²¡çµèå¨ææºä¸ç¼è¯ä¸äº#include "window.h"