Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
9a42ba8106
|
|||
|
b20a5e76a1
|
|||
|
15e536e167
|
2
LICENSE
2
LICENSE
@@ -1,7 +1,7 @@
|
|||||||
GNU GENERAL PUBLIC LICENSE
|
GNU GENERAL PUBLIC LICENSE
|
||||||
Version 3, 29 June 2007
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
© 2025 Zhang Anjun. All rights reserved.
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
of this license document, but changing it is not allowed.
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// File Name: Minesweeper.cpp
|
// File Name: Minesweeper.cpp
|
||||||
// Author: Zhang Anjun
|
// Author: Zhang Anjun
|
||||||
// Date: 2025-07-16
|
// Date: 2025-07-18
|
||||||
// Version: 1.0
|
// Version: 1.1
|
||||||
// © 2025 Zhang Anjun. All rights reserved.
|
// © 2025 Zhang Anjun. All rights reserved.
|
||||||
|
|
||||||
#include "Minesweeper.h"
|
#include "Minesweeper.h"
|
||||||
@@ -36,6 +36,13 @@ int main()
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void copyrightNotice() {
|
||||||
|
std::cout << "Author: Zhang Anjun" << std::endl
|
||||||
|
<< "Version: 1.1" << std::endl
|
||||||
|
<< "(C) 2025 Zhang Anjun. All rights reserved."
|
||||||
|
<< std::endl << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
void minesweeper()
|
void minesweeper()
|
||||||
{
|
{
|
||||||
char command;
|
char command;
|
||||||
@@ -53,6 +60,7 @@ void minesweeper()
|
|||||||
result = getResult(board, maxRow, maxCol, mineCount);
|
result = getResult(board, maxRow, maxCol, mineCount);
|
||||||
}
|
}
|
||||||
displayBoard(board, result, row, col, maxRow, maxCol, mineCount);
|
displayBoard(board, result, row, col, maxRow, maxCol, mineCount);
|
||||||
|
copyrightNotice();
|
||||||
if (result == 1) {
|
if (result == 1) {
|
||||||
std::cout << "Congratulations, you won this game!" << std::endl;
|
std::cout << "Congratulations, you won this game!" << std::endl;
|
||||||
}
|
}
|
||||||
@@ -255,7 +263,12 @@ void flipCell(Cell(&board)[9][9], const char command, const int row, const int c
|
|||||||
else if (board[row][col].status == 1) {
|
else if (board[row][col].status == 1) {
|
||||||
board[row][col].status = 0;
|
board[row][col].status = 0;
|
||||||
}
|
}
|
||||||
|
else if (board[row][col].status == 2 && (!board[row][col].mine)) {
|
||||||
|
chord(board, row, col, maxRow, maxCol);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
invalidOption();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// File Name: Minesweeper.h
|
// File Name: Minesweeper.h
|
||||||
// Author: Zhang Anjun
|
// Author: Zhang Anjun
|
||||||
// Date: 2025-07-16
|
// Date: 2025-07-18
|
||||||
// Version: 1.0
|
// Version: 1.1
|
||||||
// © 2025 Zhang Anjun. All rights reserved.
|
// © 2025 Zhang Anjun. All rights reserved.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
@@ -15,6 +15,8 @@ struct Cell {
|
|||||||
int mineNum;
|
int mineNum;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void copyrightNotice();
|
||||||
|
|
||||||
void minesweeper();
|
void minesweeper();
|
||||||
|
|
||||||
void initBoard(Cell(*ptrBoard)[9], const int maxRow, const int maxCol);
|
void initBoard(Cell(*ptrBoard)[9], const int maxRow, const int maxCol);
|
||||||
|
|||||||
Reference in New Issue
Block a user