#include<bits/stdc++.h>
using namespace std;
int dx[8]={-1,-1,-1,0,0,1,1,1};
int dy[8]={-1,0,1,-1,1,-1,0,1};
char a[100][100];
char mp[100][100];
int f(int x,int y){
int c=0;
for(int i=1;i<=8;i++){
int nx=x+dx[i];
int ny=y+dy[i];
if(a[nx][ny]''){
c++;
}
}
return c;
}
int main(){
srand(time(0));
for(int i=1;i<=10;i++){
for(int j=1;j<=10;j++){
a[i][j]='.';
mp[i][j]='x';
}
}
int s;
cout<<"输入雷的个数:\n";
cin>>s;
for(int i=1;i<=s;i++){
int xa=rand()%10+1;
int ya=rand()%10+1;
a[xa][ya]='';
}
int player1=0,player2=0;
while(1!=-1){
for(int yyyyy=1;yyyyy<=2;yyyyy++){
for(int i=1;i<=10;i++){
for(int j=1;j<=10;j++){
cout<<mp[i][j];
}
cout<<"\n";
}
cout<<player1<<" "<<player2<<"\n";
int o,p,j;
cin>>o>>p>>j;
if(a[o][p]''&&j2&&yyyyy1){
player1++;
}
else if(a[o][p]==''&&j2&&yyyyy2){
player2++;
}
if(j==1){
if(a[o][p]!='*'){
mp[o][p]=f(o,p)+'0';
}
else {
cout<<"你输了\n";
for(int i=1;i<=10;i++){
for(int j=1;j<=10;j++){
cout<<a[i][j];
}
cout<<"\n";
}
return 0;
}
}
else{
mp[o][p]='P';
}
system("cls");
}
}
}
//-1,-1 -1,0 -1,1
//
//0,-1 0,0 0,1
//
//1,-1 1,0 1,1