C++/*'Minesweeper 2026 [LOW]1.0' finish!
witer :GYB039
time :2026/8/8/7:58
place :guangzhou/fuoshan
*/
#include <bits/stdc++.h>
using namespace std;
char a[9][9];
bool f[9][9];
bool dfs (int x, int y, int i, int j) {
if (x == i && y == j && a[x][y] == '*')
return false;
if (f[x][y] == true)
return true;
f[x][y] = true;
if (a[x][y] == ' ') {
dfs (x - 1, y, i, j);
dfs (x, y - 1, i, j);
dfs (x + 1, y, i, j);
dfs (x, y + 1, i, j);
dfs (x - 1, y - 1, i, j);
dfs (x + 1, y + 1, i, j);
dfs (x + 1, y - 1, i, j);
dfs (x - 1, y + 1, i, j);
}
return true;
}
int main () {
srand (time (0));
system ("mode con cols=50 lines=30");
cout << " Welcome to 'Minesweeper 2026 [LOW]!'" << endl;
cout << "\n\n\n";
for (int i = 1; i <= 9; i ++) {
cout << " ";
for (int j = 1; j <= 9; j ++) {
if (j == 1 && i == 1)
cout << "┏ ┉ ";
else if (j == 9 && i == 1)
cout << "┓";
else if (j == 1 && i == 9)
cout << "┗ ┉ ";
else if (j == 9 && i == 9)
cout << "┛";
else if (j == 1)
cout << "┣ ┉ ";
else if (j == 9)
cout << "┫";
else if (i == 1)
cout << "┳ ┉ ";
else if (i == 9)
cout << "┻ ┉ ";
else
cout << "╋ ┉ ";
}
cout << endl;
cout << " ";
if (i != 9)
for (int j = 1; j <= 9; j ++) {
cout << "┋";
if (j != 9)
cout << " ?";
}
cout << endl;
}
cout << "\n\n\n";
cout << " you can type in any character and 'enter'\n";
cout << " Don't press too many enters while playing\n";
int u, cnt = 0;
cin >> u;
bool ans = false;
while (1) {
if (ans == false) {
for (int i = 1; i <= 8; i ++)
for (int j = 1; j <= 8; j ++)
a[i][j] = ' ', f[i][j] = false;
for (int k = 1; k <= 10; k ++) {
int x = rand () % 8 + 1;
int y = rand () % 8 + 1;
while (a[x][y] == '*') {
x = rand () % 8 + 1;
y = rand () % 8 + 1;
}
a[x][y] = '*';
}
for (int i = 1; i <= 8; i ++) {
for (int j = 1; j <= 8; j ++) {
if (a[i][j] == ' ') {
int v = 0;
if (a[i][j - 1] == '*')
v ++;
if (a[i][j + 1] == '*')
v ++;
if (a[i - 1][j] == '*')
v ++;
if (a[i + 1][j] == '*')
v ++;
if (a[i - 1][j - 1] == '*')
v ++;
if (a[i - 1][j + 1] == '*')
v ++;
if (a[i + 1][j - 1] == '*')
v ++;
if (a[i + 1][j + 1] == '*')
v ++;
if (v != 0) {
a[i][j] = v + '0';
}
}
}
}
ans = true;
cnt ++;
cout << "Round " << cnt << ":\n";
cout << "\n\n\n ";
} else
cout << "\n\n\n\n ";
for (int i = 1; i <= 8; i ++)
cout << i << " ";
cout << endl;
for (int i = 1; i <= 9; i ++) {
cout << " ";
for (int j = 1; j <= 9; j ++) {
if (j == 1 && i == 1)
cout << "┏ ┉ ";
else if (j == 9 && i == 1)
cout << "┓";
else if (j == 1 && i == 9)
cout << "┗ ┉ ";
else if (j == 9 && i == 9)
cout << "┛";
else if (j == 1)
cout << "┣ ┉ ";
else if (j == 9)
cout << "┫";
else if (i == 1)
cout << "┳ ┉ ";
else if (i == 9)
cout << "┻ ┉ ";
else
cout << "╋ ┉ ";
}
cout << endl;
if (i != 9)
cout << " " << i << " ";
else
cout << " ";
if (i != 9)
for (int j = 1; j <= 9; j ++) {
cout << "┋";
if (j != 9) {
if (f[i][j] == false)
cout << " " << "?" << " ";
else {
cout << " " << a[i][j] << " ";
}
}
}
cout << endl;
}
cout << " You can enter the row and column\n";
cout << " coordinates you clicked\n";
cout << "\n\n\n";
cout << "input :";
int x, y;
cin >> x >> y;
if (min (x, y) <= 0 && max (x, y) > 8) {
cout << "Invalid input\n";
continue;
} else {
ans = dfs (x, y, x, y);
if (ans == false) {
cout << " YOU LOSE!!\n";
cout << "\n\n\n ";
for (int i = 1; i <= 8; i ++)
cout << i << " ";
cout << endl;
for (int i = 1; i <= 9; i ++) {
cout << " ";
for (int j = 1; j <= 9; j ++) {
if (j == 1 && i == 1)
cout << "┏ ┉ ";
else if (j == 9 && i == 1)
cout << "┓";
else if (j == 1 && i == 9)
cout << "┗ ┉ ";
else if (j == 9 && i == 9)
cout << "┛";
else if (j == 1)
cout << "┣ ┉ ";
else if (j == 9)
cout << "┫";
else if (i == 1)
cout << "┳ ┉ ";
else if (i == 9)
cout << "┻ ┉ ";
else
cout << "╋ ┉ ";
}
cout << endl;
if (i != 9)
cout << " " << i << " ";
else
cout << " ";
if (i != 9)
for (int j = 1; j <= 9; j ++) {
cout << "┋";
if (j != 9) {
cout << " " << a[i][j] << " ";
}
}
cout << endl;
}
cout << "\n\n\n\n\n\n";
cin >> u;
} else {
int sum = 0;
for (int i = 1; i <= 8; i ++) {
for (int j = 1; j <= 8; j ++) {
if (f[i][j] == false)
sum ++;
}
}
if (sum == 10) {
cout << " YOU WIN!!!\n";
cout << "\n\n\n ";
for (int i = 1; i <= 8; i ++)
cout << i << " ";
cout << endl;
for (int i = 1; i <= 9; i ++) {
cout << " ";
for (int j = 1; j <= 9; j ++) {
if (j == 1 && i == 1)
cout << "┏ ┉ ";
else if (j == 9 && i == 1)
cout << "┓";
else if (j == 1 && i == 9)
cout << "┗ ┉ ";
else if (j == 9 && i == 9)
cout << "┛";
else if (j == 1)
cout << "┣ ┉ ";
else if (j == 9)
cout << "┫";
else if (i == 1)
cout << "┳ ┉ ";
else if (i == 9)
cout << "┻ ┉ ";
else
cout << "╋ ┉ ";
}
cout << endl;
if (i != 9)
cout << " " << i << " ";
else
cout << " ";
if (i != 9)
for (int j = 1; j <= 9; j ++) {
cout << "┋";
if (j != 9) {
cout << " " << a[i][j] << " ";
}
}
cout << endl;
}
cout << "\n\n\n\n\n\n";
ans = false;
} else {
cout << "\n";
}
}
}
system ("cls");
}
return 0;
}
//┏┳┓┫╋┣┗┻┛┉┋