include [HTML_REMOVED]
include [HTML_REMOVED]
include [HTML_REMOVED]
using namespace std;
int main(){
while(true){
//打印棋盘
int n = 10,j;
long long s;
cout << “输入您的验证码加enter开始.” << endl;
cin >> s;
int arr[10][10];
for(int i = 0; i < n; i){
for(int j = 0; j < n; j){
arr[i][j] = 0;
}
}
bool setin = true;//至关重要!!!!
if(s == 10086){
int winner;
//永久运行
bool win = true;
while(true){
cout << ” “;
for(int i = 0 ; i < n; i){
cout << i + 1 << ” “;
}
cout << endl;
cout << endl;
for(int i = 0; i < n; i){//正式打印
if(i >= 9){
cout << i + 1 << ” “;
}else{
cout << i + 1 << ” “;
}
if(arr[i][j] == 0){
cout << “O” << ” “;
}else if(arr[i][j] == 1){
cout << “” << ” “;
}else{
cout << “@” << ” “;
}
}
cout << endl;
}
//最最最最最重要的部分!!!!!!!!!
//判断胜负
int winner;//!!!
for(int i = 0; i < n; i){
for(int j = 0; j < n; j){
if(arr[i][j] == 1){
if(arr[i + 1][j] == 1 && arr[i + 2][j] == 1 && arr[i + 3][j] == 1 && arr[i + 4][j] == 1){
win = false;
winner = 1;
break;
}else if(arr[i][j + 1] == 1 && arr[i][j + 2] == 1 && arr[i][j + 3] == 1 && arr[i][j + 4] == 1){
win = false;
winner = 1;
break;
}else if(arr[i + 1][j + 1] == 1 && arr[i + 2][j + 2] == 1 && arr[i + 3][j + 3] == 1 && arr[i + 4][j + 4] == 1){
win = false;
winner = 1;
break;
}else if(arr[i - 1][j - 1] == 1 && arr[i - 2][j - 2] == 1 && arr[i - 3][j - 3] == 1 && arr[i - 4][j - 4] == 1){
win = false;
winner = 1;
break;
}
}
if(arr[i][j] == 2){
if(arr[i + 1][j] == 2 && arr[i + 2][j] == 2 && arr[i + 3][j] == 2 && arr[i + 4][j] == 2){
win = false;
winner = 2;
break;
}else if(arr[i][j + 1] == 2 && arr[i][j + 2] == 2 && arr[i][j + 3] == 2 && arr[i][j + 4] == 2){
win = false;
winner = 2;
break;
}else if(arr[i + 1][j + 1] == 2 && arr[i + 2][j + 2] == 2 && arr[i + 3][j + 3] == 2 && arr[i + 4][j + 4] == 2){
win = false;
winner = 2;
break;
}else if(arr[i - 1][j - 1] == 2 && arr[i - 2][j - 2] == 2 && arr[i - 3][j - 3] == 2 && arr[i - 4][j - 4] == 2){
win = false;
winner = 2;
break;
}
}
}
}
//请输入合法坐标号
//_________
//分界线
//___________
if(setin){
cout << “下棋” << endl;
}else{
cout << “@下棋” << endl;
}
cout << “请输入合法坐标号,否则爆栈处罚”;
int n1, m1;
cin >> n1 >> m1;
if(arr[n1][m1] != 0){
cout << “?—试图吞子? 没门!”;
}
if(setin == true && arr[n1][m1] == 0){
arr[n1 - 1][m1 - 1] = 1;
}else{
arr[n1 - 1][m1 - 1] = 2;
}
for(int i = 0; i < n; i){
for(int j = 0; j < n; j){
if(arr[i][j] == 1){
if(arr[i + 1][j] == 1 && arr[i + 2][j] == 1 && arr[i + 3][j] == 1 && arr[i + 4][j] == 1){
win = false;
winner = 1;
break;
}else if(arr[i][j + 1] == 1 && arr[i][j + 2] == 1 && arr[i][j + 3] == 1 && arr[i][j + 4] == 1){
win = false;
winner = 1;
break;
}else if(arr[i + 1][j + 1] == 1 && arr[i + 2][j + 2] == 1 && arr[i + 3][j + 3] == 1 && arr[i + 4][j + 4] == 1){
win = false;
winner = 1;
break;
}else if(arr[i - 1][j - 1] == 1 && arr[i - 2][j - 2] == 1 && arr[i - 3][j - 3] == 1 && arr[i - 4][j - 4] == 1){
win = false;
winner = 1;
break;
}
}
if(arr[i][j] == 2){
if(arr[i + 1][j] == 2 && arr[i + 2][j] == 2 && arr[i + 3][j] == 2 && arr[i + 4][j] == 2){
win = false;
winner = 2;
break;
}else if(arr[i][j + 1] == 2 && arr[i][j + 2] == 2 && arr[i][j + 3] == 2 && arr[i][j + 4] == 2){
win = false;
winner = 2;
break;
}else if(arr[i + 1][j + 1] == 2 && arr[i + 2][j + 2] == 2 && arr[i + 3][j + 3] == 2 && arr[i + 4][j + 4] == 2){
win = false;
winner = 2;
break;
}else if(arr[i - 1][j - 1] == 2 && arr[i - 2][j - 2] == 2 && arr[i - 3][j - 3] == 2 && arr[i - 4][j - 4] == 2){
win = false;
winner = 2;
break;
}
}
}
}
//换人下棋
if(setin){
setin = false;
}else{
setin = true;
}
cout << “成功操作棋盘” << endl;
if(win == false){
break;
}
//视觉优化
cout << endl;
cout << endl;
cout << endl;
cout << endl;
cout << endl;
cout << endl;
cout << endl;
cout << endl;
cout << endl;
cout << endl;
cout << endl;
cout << endl;
cout << endl;
cout << endl;
cout << endl;
cout << endl;
cout << endl;
cout << endl;
cout << endl;
cout << endl;
cout << endl;
cout << endl;
cout << endl;
cout << endl;
cout << endl;
cout << endl;
cout << endl;
cout << endl;
cout << endl;
cout << endl;
cout << endl;
cout << endl;
cout << endl;
cout << endl;
cout << endl;
cout << endl;
cout << endl;
cout << endl;
cout << endl;
cout << endl;
cout << endl;
cout << endl;
cout << endl;
cout << endl;
}
cout << “本局结束,”;
cout << “胜利者:”;
if(winner == 1){
cout << “@”;
}else{
cout << “*”;
}
cout << ” 若要再来一局,请打S并enter” << endl;
}else{
cout << “你是怎么得到我的?” << endl;
}
}
return 0;
}