all bombs revealed

master
thunic 2 years ago
parent b37dbd909e
commit 915390cef2

@ -187,10 +187,18 @@ int revealCell(int** gameBoard, int** hiddenGameBoard, int size, int row, int co
if (hiddenGameBoard[pos.row][pos.col] != HIDDEN_CELL) {
return 1;
}
if (gameBoard[pos.row][pos.col] == FLAG_CELL){
if (hiddenGameBoard[pos.row][pos.col] == FLAG_CELL){
return 1;
}
if (gameBoard[pos.row][pos.col] == BOMB_CELL) {
hiddenGameBoard[pos.row][pos.col] = gameBoard[pos.row][pos.col];
for (int i = 0; i < size; i++) {
for (int j = 0; j < size; j++) {
if (gameBoard[i][j] == BOMB_CELL) {
hiddenGameBoard[i][j] = gameBoard[i][j];
}
}
}
handleBombExploded();
return 0;
}
@ -249,6 +257,8 @@ int checkWin(int** gameBoard, int** hiddenGameBoard, int size, int numBombs, int
void handleBombExploded() {
char message[] = "Spiel Verloren! Du hast eine Bombe getroffen!\r\nStarte neu mit der ON Taste. \r\n";
HAL_UART_Transmit(&huart2, (uint8_t*)message, sizeof(message), 100);
}

Loading…
Cancel
Save