#include <iostream> #include <iomanip> int h=16; int l=16; bool is_black=true; int all_list[16][16]; bool black_list[16][16]; bool while_list[16][16]; int x; int y; using namespace std; void f5(){ for(int i=0;i<=h;i++){ cout<<setw(3)<<i; } cout<<endl; for(int i=0;i<h;i++){ cout<<setw(3)<<i+1; for(int ii=0;ii<l;ii++){ if(all_list[i][ii]==0){ cout<<setw(3)<<"."; }else if(all_list[i][ii]==1){ cout<<setw(3)<<"黑"; }else if(all_list[i][ii]==2){ cout<<setw(3)<<"白"; } } cout<<endl; } } bool black_iswin(){ for(int i=0;i<h;i++){ for(int ii=0;ii<l;ii++){ } } } bool while_iswin(){ } int main(int argc, char** argv) { while(1){ system("cls"); f5(); if(is_black){ cout<<"黑子落棋"<<endl; cin>>x>>y; if(all_list[x-1][y-1]!=0){ continue; } all_list[x-1][y-1]=1; black_list[x-1][y-1]=true; if(black_iswin){ cout<<"黑子胜利"; return 0; } is_black=false; }else{ cout<<"白子落棋"<<endl; cin>>x>>y; if(all_list[x-1][y-1]!=0){ continue; } all_list[x-1][y-1]=2; while_list[x-1][y-1]=true; if(while_iswin){ cout<<"白子胜利"; return 0; } is_black=true; } } return 0; }
标签:游戏,16,int,五子棋,list,while,black,bool From: https://www.cnblogs.com/wangyueshuo/p/17621455.html