From b7a41d232c392c5b4c87d7e01f804c3dffd5fd55 Mon Sep 17 00:00:00 2001 From: Daniel M Date: Thu, 8 Feb 2024 11:34:41 +0100 Subject: [PATCH] game_end --- .../out/c/duellist-spielesammlung-projekt.o | Bin 12952 -> 13524 bytes .../test_duellist_spielesammlung_projekt.out | Bin 97038 -> 98062 bytes .../test_duellist_spielesammlung_projekt.pass | 2 +- src/main/duellist-spielesammlung-projekt.c | 29 ++++++++++++++++++ 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/build/test/out/c/duellist-spielesammlung-projekt.o b/build/test/out/c/duellist-spielesammlung-projekt.o index b5320eb3d383c57914284f84f085f1a733df72fe..8bbf2dc84b4eb0eb9e6cd101e8de5794555378c6 100644 GIT binary patch delta 1176 zcmaKreMl2w9LJyMcC9gAuUSck-t3$&F{frhF9g<>NCuUzv=?Hz%QW3gH_adhE=xIz z)ga$1L-7A#G@Qq})D!5=Lhf+PJ zVkk(?h~$X&Rtsz|D@2{-U1|m1LCoBGoJDqW+4v!Gan`_^8CEEVL89tlPt}R$tKnO6 z%mt&k*D)tK!kP%H&QHaks2V?&l#6*P<%D{4>%@hXQ0*S?OjjG)1r{=E;+gZmAX9R} z{zwcA$H0gN23X-7CEuvz@vyXSZfW*oLRxR7kP2r=1lk}u7Sv6Wu)vRm%D8K#5YBOtmiZ< zYgw!hu=%rp6y=(BYlBnvqsJ$Wh=&X1Y;q&39Of!<;GnmIZ}zwO_>&@hd>x|b;fr~f z$Ia)s%|?WFdz<{tp8p~UGPVKE$5>5vxY~HX=ajeA=l8gLVpAvY;+q>hB1D$AiY}j- zuktpvi|$0e&fD55*7=$`&4}chMwn7ges9{VV}=>IVC_vqlKTF}uNU%c)(IB36RS{A zHV`6+VX?kTKc=mB^nQcw$Uk|EDM>Q~4Ihgc0oKtHU9F)@mr$dF^TW1UMlXAXJ|UH}?zr)EC|2SC|0@Co%sLB)odq25bS zHjT?jjW^*z#hTcuS3$iI>OBLssz}?cP?P24NBO_l73xE(AV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?`@`ct2q>K=$bWm$BQ2i=_h=~41 z2gE}-JRdWM%~h~w{?;N2T~)?UQhr5Gc`hM1CWEEgtI7uTY+ zPh?X7H%j>z*~C}q_}CnpU(oSsIV9Iw%5^mNJ2PV0SI1J7Uiv85u(GnGtU{yXALg(U zaMy8FF7>l?e0MITta(V10+Eh7(?KfbpAiF3OZmfG7U}YGDMI2oNwk;p&^(Igsg7^T zW7&S2N7&fzLK}YwDX3hlTl?C|_4-oYpGVfzL+KXQ-X&Q{$7AzZC%Bh!SVDf)W!#T? zmw;h5)|83DG?nuFB~*wW9dBDAPF*SgeF-}UPG$VuQkLR(VJHuD`RH_OmrIHv8^YTk z=^uQtW!$@f;*ds^%)w2P(sX=P0cBmS1s`P-%EcQ0q#J^uk{sXzAs diff --git a/build/test/results/test_duellist_spielesammlung_projekt.pass b/build/test/results/test_duellist_spielesammlung_projekt.pass index 4f971f9..bdcfc4b 100644 --- a/build/test/results/test_duellist_spielesammlung_projekt.pass +++ b/build/test/results/test_duellist_spielesammlung_projekt.pass @@ -75,4 +75,4 @@ :failed: 0 :ignored: 0 :stdout: [] -:time: 0.043742199999996956 +:time: 0.04494909999993979 diff --git a/src/main/duellist-spielesammlung-projekt.c b/src/main/duellist-spielesammlung-projekt.c index b426da5..2f95108 100644 --- a/src/main/duellist-spielesammlung-projekt.c +++ b/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; }