#include <iostream>
#include <iomanip>
using namespace std;
int row=16;
int col=16;
bool black=true;
int all[17][17];
void F5(){
    for(int ii=0;ii<=col;ii++){
        cout<<setw(3)<<ii;
    }
    cout<<endl;
    for(int i=0;i<row;i++){
        cout<<setw(3)<<i+1;
        for(int j=0;j<col;j++){
            if(all[i][j]==0){
                cout<<setw(3)<<".";
            }else if(all[i][j]==1){
                cout<<setw(3)<<"黑";
            }else if(all[i][j]==2){
                cout<<setw(3)<<"白";
            }
        }
        cout<<endl;
    }
}

int main(){
    int x,y;
    while(1){
        system("cls");
        F5();
        if(black){
            cout<<"黑棋请落子"; 
            cin>>x>>y;
            if(all[x-1][y-1]!=0||x<0||y<0||x>16||y>16){
                continue;
            }
            all[x-1][y-1]=1;
            black=false;
        }else{
            cout<<"白棋请落子";
            cin>>x>>y;
            if(all[x-1][y-1]!=0||x<0||y<0||x>16||y>16){
                continue;
            }
            all[x-1][y-1]=2;
            black=true;
        }
    }
    return 0;
}

  

posted on 2023-11-05 09:30  黛玉醉打将门神  阅读(15)  评论(0编辑  收藏  举报