名场面:
棋盘赢力!(悲
code:
#include<bits/stdc++.h>
#include<windows.h>
#define int long long
#define move move114514
using namespace std;
char mp[114][114];
bool move = 0, used[114][114];
inline bool check(int x, int y, char ch) {
if (ch == '.') return 0; // fuckkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
if (mp[x - 1][y] == ch)
if (mp[x - 2][y] == ch)
if (mp[x - 3][y] == ch)
if (mp[x - 4][y] == ch)
return 1;
if (mp[x + 1][y] == ch)
if (mp[x + 2][y] == ch)
if (mp[x + 3][y] == ch)
if (mp[x + 4][y] == ch)
return 1;
if (mp[x - 1][y - 1] == ch)
if (mp[x - 2][y - 2] == ch)
if (mp[x - 3][y - 3] == ch)
if (mp[x - 4][y - 4] == ch)
return 1;
if (mp[x - 1][y + 1] == ch)
if (mp[x - 2][y + 2] == ch)
if (mp[x - 3][y + 3] == ch)
if (mp[x - 4][y + 4] == ch)
return 1;
if (mp[x + 1][y - 1] == ch)
if (mp[x + 2][y - 2] == ch)
if (mp[x + 3][y - 3] == ch)
if (mp[x + 4][y - 4] == ch)
return 1;
if (mp[x + 1][y + 1] == ch)
if (mp[x + 2][y + 2] == ch)
if (mp[x + 3][y + 3] == ch)
if (mp[x + 4][y + 4] == ch)
return 1;
if (mp[x][y - 1] == ch)
if (mp[x][y - 2] == ch)
if (mp[x][y - 3] == ch)
if (mp[x][y - 4] == ch)
return 1;
if (mp[x][y + 1] == ch)
if (mp[x][y + 2] == ch)
if (mp[x][y + 3] == ch)
if (mp[x][y + 4] == ch)
return 1;
return 0;
}
signed main() {
memset(mp, '.', sizeof(mp));
while (1) {
printf(" ");
for (int i = 1; i <= 30; ++i) {
printf("%lld", i);
if (i < 10) putchar(' ');
}
putchar('\n');
for (int i = 1; i <= 30; ++i) {
if (i < 10) putchar(' ');
printf("%lld", i);
for (int j = 1; j <= 30; ++j) {
putchar(mp[i][j]);
putchar(' ');
}
putchar('\n');
}
int x = 0, y = 0, cnt = 0;
scanf("%lld %lld", &x, &y);
while (mp[x][y] == 'O' || mp[x][y] == 'X') {
if (cnt > 0) {
printf("You can't put yours here.\n");
} else if (cnt > 3) {
printf("Move your FUCKING chess away bitch\n");
}
scanf("%lld &lld", &x, &y);
cnt ++;
}
if (!move) mp[x][y] = 'O', system("color 70");
else mp[x][y] = 'X', system("color 07");
for (int k = 1; k <= 30; ++k)
for (int l = 1; l <= 30; ++l)
if (check(k, l, mp[k][l])) {
system("color 46");
system("cls");
for (int i = 1; i <= 30; ++i) {
for (int j = 1; j <= 30; ++j) {
putchar(mp[i][j]);
putchar(' ');
}
putchar('\n');
}
printf("The player who is using %c wins!\n", mp[k][l]);
system("pause");
return 0;
}
system("cls");
move ^= 1;
}
}操作方法:每次移动输入坐标即可

