Browse Source

game_end

remotes/origin/Daniel
Daniel M 11 months ago
parent
commit
b7a41d232c
  1. BIN
      build/test/out/c/duellist-spielesammlung-projekt.o
  2. BIN
      build/test/out/test_duellist_spielesammlung_projekt.out
  3. 2
      build/test/results/test_duellist_spielesammlung_projekt.pass
  4. 29
      src/main/duellist-spielesammlung-projekt.c

BIN
build/test/out/c/duellist-spielesammlung-projekt.o

BIN
build/test/out/test_duellist_spielesammlung_projekt.out

2
build/test/results/test_duellist_spielesammlung_projekt.pass

@ -75,4 +75,4 @@
:failed: 0
:ignored: 0
:stdout: []
:time: 0.043742199999996956
:time: 0.04494909999993979

29
src/main/duellist-spielesammlung-projekt.c

@ -340,7 +340,36 @@ int minesweeper() {
if ((row == -1) && (column == -1)) {
break;
}
// Check field boundaries
if (row >= height || row < 0) {
printf("Row must be between 1 and %d!\n", height);
continue;
}
if (column >= width || column < 0) {
printf("Column must be between 1 and %d!\n", width);
continue;
}
// Did you land on a mine?
if (field_check(minefield, mines, height, width, row, column) == 0) {
// Show the mines
show_minefield(mines, height, width);
printf("Row: %d Column: %d was unfortunately a mine!\n", row + 1, column + 1);
break;
}
// Are you done?
else if (end_check(minefield, mines, height, width)) {
// Show the mines
show_minefield(mines, height, width);
printf("Great! Solved correctly!\n");
break;
}
// Show current field to continue playing
else {
show_minefield(mines, height, width);
}
}
return 1;
}
Loading…
Cancel
Save