五子棋-只管下棋不可以求输赢~~

发布时间 2023-08-10 20:31:57作者: 王华立(小号)

#include <bits/stdc++.h>
using namespace std;
int lie=16;
int hang=16;
bool IS=true;
int quan[16][16];
void f5(){
for(int i=0;i<=lie;i++){
cout<<setw(3)<<i;
}
cout<<endl;
for(int l=0;l<lie;l++){
cout<<setw(3)<<l+1;
for(int h=0;h<hang;h++){
if(quan[l][h]==1){
cout<<setw(3)<<"黑";
}else if(quan[l][h]==2){
cout<<setw(3)<<"白";
}else{
cout<<setw(3)<<".";
}

}
cout<<endl;
}
}
int main( ){
int x,y;
while(true){
system("cls");
f5();
if(IS==true){

cout<<"黑子请下棋:"<<endl;
cin>>x>>y;
if(quan[x-1][y-1]!=0){
continue;
}
quan[x-1][y-1]=1;
IS=false;
}else{
cout<<"白子请下棋"<<endl;
cin>>x>>y;
if(quan[x-1][y-1]!=0){
continue;
}
quan[x-1][y-1]=2;
IS=true;
}
}
return 0;
}