From 0a66dce53bead8d3d3f20156ef17579621a3af0d Mon Sep 17 00:00:00 2001 From: Daniel M Date: Thu, 8 Feb 2024 12:15:51 +0100 Subject: [PATCH 1/7] =?UTF-8?q?refactoring=20:=20Zeillen=20abstandverbesse?= =?UTF-8?q?rt=20um=20Code=20=C3=BCbersichtlicher=20zumachen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../out/c/duellist-spielesammlung-projekt.o | Bin 13912 -> 13908 bytes .../test_duellist_spielesammlung_projekt.out | Bin 102734 -> 102734 bytes .../test_duellist_spielesammlung_projekt.pass | 2 +- src/main/duellist-spielesammlung-projekt.c | 11 ++++------- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/build/test/out/c/duellist-spielesammlung-projekt.o b/build/test/out/c/duellist-spielesammlung-projekt.o index c4f8ca157d31be18a2193977aae32e3aa6ada235..ba37b1f72e617bda3092fa706a2069a2a7983c5d 100644 GIT binary patch delta 433 zcmcbSb0vqb=K+X3=GdU?`7;2XSAK{Eh$-V$M_Fu3e&^{K~^Bm2;;^G73G&BxDi6h z`8lPzc?gjZK^c&G52*GWL6CD8eHpJaf=tU0R0DDSpxhJ&;k2UE)cD-YywtSJ)SMIs zMq|bnJ_ZI)9gwm)M}Y1X0UKZp)xjVl3X(B~8qXq>$-rnbnO{mYNewK-1Jqmr)@u!P zH$<-*Trb#i7?%ZN6ht4>L=F+KM`2tZkjd&$Yf6N&fSk>3Qa9NdpDa#LVrKN-oTzHZ z$RZMHkTH3hnhImriD={!UnC!}^%;-5e zlTn?qbn-+-b=H~c3=FR}?`7;2XLOwGEh$;=#P|aVhL6CD8{TZ(_f=tU0R0DAXpxhJ&;k2UE)cD-YywtSJ)SMIs zMsvm%J_ZI)9gwm)M}Y1X0UKZr)xjVl3X(C08qXq>$-rnanO{mYNdqjz1Jqmr)@u!P zH$<-nTrb#i7?%ZN6ht4>L=F+KM`2tZkja`*Yf6N&fSk>3Qa9NdpDj*MVrKN&oTzHZ z$RZkPkU4ppnhG;BXVc`}YVwTwlW(g@@)>aK2EymNIj-+sIC1i1CUrg5NRB3E?#-s^ TpP4qRX-RN0zS?YWEXoW3dgxyC diff --git a/build/test/out/test_duellist_spielesammlung_projekt.out b/build/test/out/test_duellist_spielesammlung_projekt.out index 931e9533b13fed55867dd3ccbd4ae50de5e97395..5169aa3c025e69a26e96cd5219c936f28fa1122a 100644 GIT binary patch delta 478 zcmX@Ni0#}Wwh0|f%eGJK@?%mE*?23CiSf*4OXhPg>TMbSF)%RjMmR8BVParloKw!i zz#w=MD8y(7mSLKhAh;8m8zWSdUyhKC5K7L^Db3A8h=d4U0IBzYYR?he590bVUT0)r zV49dAcnie!gK{Ugy%DZAW;_z^z~BiIpK}CgzX(`|F;oeI2-rEsQ1e)XG8q_6V1_e@ zrsk!@CugK4XEQLWfkl0QW>tXAvSx*ur3N<(Y&(q00ybJ3s*!0ThX~lK5ObI&@_?*T zhgwx4lm+B$c7E%~#^fn5dFKh!&AUI>a4@oLw)oS;$XL30_upm4j8B#)88R|6dT&oQ zVKii95s5U&m_EalQH8N<`hHVJc}9cj_e~ik`3yOBbL`=GzMJFv?gbMkO=mM>)MJh2 zXkzBvZfVANoO$~{OGX<}rWY*JA2>3KY!C2f>|tW`+D&%P>t$5ZsB(jS(u!FGt8m2qov|l;-9kL_!2FfYf_KwdV-#2XXxwuQM_* zFip%5yanP0K)I9K-U!#5Gad$qh&fCXc|cZa zLaizh$^vpWJHK^gWAYZ5yz_+V=G~ubI2hSBTl{HaWGvsj`|mPij%PsUGcn9ym>y`x zD7?MKkntH4qtEta6GlTu7STw9%;_^s8C95>Ih&^MHD#1%)SrIWlu?q;fMYihKHtr8 zefPqNlc%$oG3v2Kax^h>Z#Oq%JkGq$iqT4x=@rZL2ab#)+XMU=dzcu#x8Dt9tY=|l S+a4Rnco}H_cEbopSxW$k(|u|H diff --git a/build/test/results/test_duellist_spielesammlung_projekt.pass b/build/test/results/test_duellist_spielesammlung_projekt.pass index 03dadd2..c0b331f 100644 --- a/build/test/results/test_duellist_spielesammlung_projekt.pass +++ b/build/test/results/test_duellist_spielesammlung_projekt.pass @@ -115,4 +115,4 @@ :failed: 0 :ignored: 0 :stdout: [] -:time: 0.0499390999998468 +:time: 0.05679710000003979 diff --git a/src/main/duellist-spielesammlung-projekt.c b/src/main/duellist-spielesammlung-projekt.c index d0a7c8b..df02795 100644 --- a/src/main/duellist-spielesammlung-projekt.c +++ b/src/main/duellist-spielesammlung-projekt.c @@ -216,7 +216,6 @@ void show_minefield(char** minefield, int height, int width) { int field_check(char** minefield, char** mines, int height, int width, int row, int column) { char counter = 0; - if ((row < 0) || (row >= height) || (column < 0) || (column >= width)) { printf("Exception: Outside the minefield!\n"); return -1; @@ -289,13 +288,11 @@ int field_check(char** minefield, char** mines, int height, int width, int row, if ((row - 1 >= 0) && (column - 1 >= 0) && (minefield[row - 1][column - 1] == unknown_character) && (mines[row - 1][column - 1] == 0)) { field_check(minefield, mines, height, width, row - 1, column - 1); } - return 1; } int end_check(char** minefield, char** mines, int height, int width) { int i, j; - for (i = 0; i < height; i++) { for (j = 0; j < width; j++) { // If a field is not uncovered and does not contain a mine, the game is not over @@ -304,7 +301,6 @@ int end_check(char** minefield, char** mines, int height, int width) { } } } - return 1; } @@ -324,6 +320,7 @@ int minesweeper() { scanf("%d", &height); printf("Enter the width of the game field:\n"); scanf("%d", &width); + if (height <= 0 || width <= 0 || height > max_height || width > max_width) { printf("Invalid field dimensions.\n"); return 1; @@ -331,21 +328,21 @@ int minesweeper() { int num_mines = calculate_mines(height, width); printf("The game field is >%d< in height and >%d< in width.\n", height, width); printf("There are %d mines on the game field.\n", num_mines); + // Matrix for the game field char** minefield = create_minefield(height, width, unknown_character); char** mines = create_minefield(height, width, 0); + distribute_mines(mines, height, width, num_mines); - while (1) { + while (1) { printf("Enter 'row column' to uncover (to quit enter '0 0'):\n"); if (scanf("%d %d", &row, &column) != 2) { printf("Incorrect input!\n"); return 1; } - row--; column--; - // Quit if ((row == -1) && (column == -1)) { break; From d2655de9c35a028c1f68993033a5066289997030 Mon Sep 17 00:00:00 2001 From: Daniel M Date: Thu, 8 Feb 2024 12:23:34 +0100 Subject: [PATCH 2/7] =?UTF-8?q?refactoring=20:=20Zeillen=20abstandverbesse?= =?UTF-8?q?rt=20um=20Code=20=C3=BCbersichtlicher=20zumachen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../out/c/duellist-spielesammlung-projekt.o | Bin 13908 -> 13908 bytes .../test_duellist_spielesammlung_projekt.out | Bin 102734 -> 102734 bytes .../test_duellist_spielesammlung_projekt.pass | 2 +- src/main/duellist-spielesammlung-projekt.c | 10 +++++++--- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/build/test/out/c/duellist-spielesammlung-projekt.o b/build/test/out/c/duellist-spielesammlung-projekt.o index ba37b1f72e617bda3092fa706a2069a2a7983c5d..cbb206443264b434d714a98ad06a98a3eddd222d 100644 GIT binary patch delta 947 zcmY*X&ubGw6n+!7>7v1yG-_`%(w=s|@6G$Z_r94!_t5=v*C027dxp`u zN&W&rq`R4z<6jcOO44hzXYfhVYPhZ4`iyy;Fva=%s@+YT74RWBB0`NO3IaY-(1wMY z=Q!0}R(ER5acv-F^6DJGolD|a|Az*ULV>dCfK*yk%1T~KG9c?gJeTeik&5x=J?y>8 z=a#+2X)l_GP?J)!FVfXhxM&DtLiwVy@srPH;5jVftW}FT)(((k5!8d=LvEpSEVqOV z8Y!e@aAZ8jZ8B)1P%MjaDs(;@rm2XOVKrKH-|>L_oWlSckZaOL`($F{?_6=8S4pK` zi~?jZuyHsFnvdmWYSLUG-QX)uWW_c3hU%X}&Sp*DV^3SYyqhMFVbIN|I>S?{!&9mX z=^16A)CBgEj2Ek|3TzeyGHa{$A(jQF+!a}6022x1NV>0`rf9C7?IHM5JNVFE+ZtJVp zN8_n32u31BlxC;+L0!3U5lHLIq;GVZk;#PVMzYYQ zAB3S8OB7V%N?X;VlU*SZMmT z-PmzjcGIz43rLkbJ_T_7EI&5*t^njvpej2cm*#@gp}w@^wbmQX+= ziIf74jK`Qw0c|8o6){eUP8Z`eC6UuiuhR-_AIOh64A6s8n|k5@iH*N8#pkR_>Vq>$ zfC2_Kjz>ZBvA9e{m`kK;Y{k!_;%aO|`A?x_IqkrA?sfukH*Fxps8`N)hsRWh$5bU! z3-|yeN^y_(v4_9avKrKOwrMbBsfKLmSOJ}q7A%^+y(R7C)94>|*_M0kO?UxF-;w{M$b(q>O_5XrB#c5E>?tdh#;tMMZJ4~@yx AwEzGB diff --git a/build/test/out/test_duellist_spielesammlung_projekt.out b/build/test/out/test_duellist_spielesammlung_projekt.out index 5169aa3c025e69a26e96cd5219c936f28fa1122a..824d61c2e194704a73a2b781089a3f1d71fcd848 100644 GIT binary patch delta 968 zcmY+CO=uHA6vy8z+qj2FP0Xi_XNe#h`jKGKL`6hsi;7^uLKBm1cWRnQx*;NzD1wNf zamgW&E*Of3c$6MWvqCOK@KO~Np@(`9y!er;r{c`p*+g&qe{bLaH~%-Yv+mkicRhbB zt!)`kW~B7}*SjZvRL_xp05~|Cf=?0vF)K2F=N&7N^VpG$v}fyIIp-}ED}(N=H(Sh? zmkWc+b|CAWdd%9d+C0_`DWN4mUF0Tn$fAsTkHBPo~q~J2Io7;@GV71ABT{R(v` zijY-s4GC)4;W+>muhhcrfG9XRWiVi)BcYlloG_pAe5UkUpdTD zhFzVe(nU@0SG6!!D>SET{bCLR*^-(O$HBz|X>$7K>H7EI-b+o}66}CN$)O6>HOgLQ za|oZ_+z4LDn!THJ3zH~Of`^X;#zPmR+Lj`VhwYYB!($f&T1zuOR z2(>ObBuW$vrgteMNQ7L9;H4@k(p(E({FAGv(wR52iQe{mZ{PQu@6GHs9J>w2v&YI- z+j^2zPI=z;&i*XVkOKfXIvaQ~=jURw6O%DAt1O-M@0qUC5V)-C1`!pDnKD zhLxMH&;0+Zay;wma+x6C34mfzSC7l2l$A%nj+Y~3=T;o9@p^rS@jW;Zk-vZkj}wu8 zs@nh(wavk+=Q8tYs;5_gjAQjW^SXy#(<8Rm_`nP4wp7u&EC&@!^I%lrqgYOkIxSJA zdwD4Cf^X5#vjg%TU*g7%ICLF6#0LiUV~9PG8vMwWO7&wR9AeNZKT@T125`Sp9Shj& zl?6{QoiFB0y#SSq{SU|Tj8K`nkd#Zm=FDlN#uwM8czWZC35 zg%cTL%`6yqil#olYUK1aAk7C1vW`pba0sSpa!6URK*VYON0CbN<71G@$(dU=vyfs} zM|ER~nu970Vzp#sOgboLz?UxQDR~@RJdhfve@j$;{Bd8Y2}=+GrBVYW!=wg#nY9so zdUIoVCC|lf7D9g$ak#)TO&$T@2YXSu*!TKg3NLzcnnga(+I%;!D$D)Qf3BiM8^hS1YV?6>KI0Uy8XWY<= height) || (column < 0) || (column >= width)) { printf("Exception: Outside the minefield!\n"); return -1; } - // If there is a mine at this position if (mines[row][column] == 1) { return 0; } - - // If there is no mine at the position, count how many mines are around it if ((row + 1 < height) && (mines[row + 1][column] == 1)) { counter++; } @@ -291,6 +293,7 @@ int field_check(char** minefield, char** mines, int height, int width, int row, return 1; } +//Überprüfe ob eine Mine getroffen wurde int end_check(char** minefield, char** mines, int height, int width) { int i, j; for (i = 0; i < height; i++) { @@ -304,6 +307,7 @@ int end_check(char** minefield, char** mines, int height, int width) { return 1; } +//befreie anliegendes Feld void free_minefield(char** minefield, int height) { int i; // Free each vector From b4d7aaaed7227c1e59f26430346b7953a2d6af7d Mon Sep 17 00:00:00 2001 From: Daniel M Date: Thu, 8 Feb 2024 12:34:26 +0100 Subject: [PATCH 3/7] =?UTF-8?q?refactoring=20:=20Die=20Prints=20wurde=20?= =?UTF-8?q?=C3=BCbersetzt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/duellist-spielesammlung-projekt.c | 23 +++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/main/duellist-spielesammlung-projekt.c b/src/main/duellist-spielesammlung-projekt.c index e8900fe..f6f136f 100644 --- a/src/main/duellist-spielesammlung-projekt.c +++ b/src/main/duellist-spielesammlung-projekt.c @@ -225,6 +225,7 @@ int field_check(char** minefield, char** mines, int height, int width, int row, printf("Exception: Outside the minefield!\n"); return -1; } + if (mines[row][column] == 1) { return 0; } @@ -320,18 +321,18 @@ void free_minefield(char** minefield, int height) { int minesweeper() { int height, width, row, column; - printf("Enter the height of the game field:\n"); + printf("Geben Sie die Grösse des spielfeldes ein:\n"); scanf("%d", &height); - printf("Enter the width of the game field:\n"); + printf("Geben Sie breite des Spielfeldes ein:\n"); scanf("%d", &width); if (height <= 0 || width <= 0 || height > max_height || width > max_width) { - printf("Invalid field dimensions.\n"); + printf("unpassen form gewählt.\n"); return 1; } int num_mines = calculate_mines(height, width); - printf("The game field is >%d< in height and >%d< in width.\n", height, width); - printf("There are %d mines on the game field.\n", num_mines); + printf("Das spielfeld hat eine grösse von >%d< und eine breite von: >%d<.\n", height, width); + printf("Es gibt %d Minen auf dem Spielfeld.\n", num_mines); // Matrix for the game field char** minefield = create_minefield(height, width, unknown_character); @@ -340,9 +341,9 @@ int minesweeper() { distribute_mines(mines, height, width, num_mines); while (1) { - printf("Enter 'row column' to uncover (to quit enter '0 0'):\n"); + printf("Geben 'vertikale horizonatle' ein um zu spielen Bsp vertikal 0 und horizontal: 0\n"); if (scanf("%d %d", &row, &column) != 2) { - printf("Incorrect input!\n"); + printf("Falsche eingabe!\n"); return 1; } row--; @@ -353,11 +354,11 @@ int minesweeper() { } // Check field boundaries if (row >= height || row < 0) { - printf("Row must be between 1 and %d!\n", height); + printf("höhe zwischen 1 und %d!\n", height); continue; } if (column >= width || column < 0) { - printf("Column must be between 1 and %d!\n", width); + printf("breite zwischen 1 und %d!\n", width); continue; } @@ -365,14 +366,14 @@ int minesweeper() { 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); + printf("höhe: %d breite: %d war leider eine 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"); + printf("Sie haben es erfolgreich gelösst!\n"); break; } // Show current field to continue playing From 15280f738df228a24286781bd0d5d304e6062404 Mon Sep 17 00:00:00 2001 From: Daniel M Date: Thu, 8 Feb 2024 12:35:42 +0100 Subject: [PATCH 4/7] =?UTF-8?q?refactoring=20:=20Es=20wurden=20=C3=B6=20du?= =?UTF-8?q?rch=20oe=20gewechselt,=20u=20durch=20ue.usw?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/duellist-spielesammlung-projekt.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/duellist-spielesammlung-projekt.c b/src/main/duellist-spielesammlung-projekt.c index f6f136f..bac07f6 100644 --- a/src/main/duellist-spielesammlung-projekt.c +++ b/src/main/duellist-spielesammlung-projekt.c @@ -331,7 +331,7 @@ int minesweeper() { return 1; } int num_mines = calculate_mines(height, width); - printf("Das spielfeld hat eine grösse von >%d< und eine breite von: >%d<.\n", height, width); + printf("Das spielfeld hat eine groesse von >%d< und eine breite von: >%d<.\n", height, width); printf("Es gibt %d Minen auf dem Spielfeld.\n", num_mines); // Matrix for the game field @@ -354,7 +354,7 @@ int minesweeper() { } // Check field boundaries if (row >= height || row < 0) { - printf("höhe zwischen 1 und %d!\n", height); + printf("hoehe zwischen 1 und %d!\n", height); continue; } if (column >= width || column < 0) { @@ -373,7 +373,7 @@ int minesweeper() { else if (end_check(minefield, mines, height, width)) { // Show the mines show_minefield(mines, height, width); - printf("Sie haben es erfolgreich gelösst!\n"); + printf("Sie haben es erfolgreich geloesst!\n"); break; } // Show current field to continue playing From 7af65b97ce7af7b8eeba5886d98b94afc1446151 Mon Sep 17 00:00:00 2001 From: Daniel M Date: Thu, 8 Feb 2024 12:46:23 +0100 Subject: [PATCH 5/7] refactoring : Genauer defefinierter bezeichner(eindeutiger bezeichner) --- .../out/c/duellist-spielesammlung-projekt.o | Bin 13908 -> 13924 bytes .../test_duellist_spielesammlung_projekt.out | Bin 102734 -> 102734 bytes .../test_duellist_spielesammlung_projekt.pass | 118 ------------------ src/main/duellist-spielesammlung-projekt.c | 8 +- 4 files changed, 5 insertions(+), 121 deletions(-) delete mode 100644 build/test/results/test_duellist_spielesammlung_projekt.pass diff --git a/build/test/out/c/duellist-spielesammlung-projekt.o b/build/test/out/c/duellist-spielesammlung-projekt.o index cbb206443264b434d714a98ad06a98a3eddd222d..4c746690c278380c87d9d4cc48156adc053b9453 100644 GIT binary patch delta 2486 zcmZuze{2**6rQ=>!4+HRU9Z2OrBmQIj+9D^CFUf6*g_yEHV{-&gzMe3yRzLadwU!- zF>4SF#DJcoq6SScmXH83@dzkJBq?Yx@{brH0mVfAXbg#x7{vsPZ)SGq#CS=Y?|tvR z@BNtBz5C9%X;iMo4Y3@NQPbiO`V*LVuJ#$Gd{1)su#&5DN-S@G4&g z=Quvz-+Oak&zvAo7W=*?iQj!aLU1c+xRJ8J&keV4I>AKF7X}uEDohUF{||QrqLMq65?<>vc-9 z@VCkyKb6Y?ra6)u(Wx;=4UVa9rcgW!9hKt;Y^pmlbp3xr^X5nzbWAd6*~4Ur7REo+ z45tI~d(!_>CYqaexHu(4wncg69hOO!#IfuDSk*AlrsrG5qr=whTsS?8tm8L%X3&?-6?#a6s})UF?kvO z8}!exzNT7txxj(q)<_6A?3?{j+bWdJr=uCm$Pb%kW<#Wz$FK3yjR=2A@H%`2u34a{ zMdotzNzcrp+CiJrExg%5xH(ybyYcp^2(51CVTaDcgAx-0-ChQY!8669c&CA4FsdWG zm`$5r=OzU8S2aRAMeZZex6DnbTv6ONgHlT71&ZOA7}Phbxbi%&j1zsXY>c3K(d!mC zw#+t!uklt=?qr0%n8cg@5_B3w)7RwCs6o{AtYCwfKx9GH22s_ssv5<1J*%eCU#>^Q znle`2bf}H+^^n-7g{J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^sY zphoK*KhTwo!loRhXIk3v%HqwI7kzUl;UX{nW{YEsmMb*|QdC?yTse}X?=HEDj}|A| zKdNYD*{Hj=>Sd*8t}k`QuYw~1GzIH=iw?vV<6fGJEySPEL-2PSJsw-A)Ya0f*Cs zOLiF)YczyzNp@SZdGPR8A>_hzBS>M>3`(RdldMa!ji4X}GIq<^5jlHEvVvrvNOnrH zi;{f<$`$3VNqAERR>0#F2&llhZSVsZkRz8c#;mR W+N1n{^W7mjv+6l~y|{ICL&e`zAK0h> diff --git a/build/test/out/test_duellist_spielesammlung_projekt.out b/build/test/out/test_duellist_spielesammlung_projekt.out index 824d61c2e194704a73a2b781089a3f1d71fcd848..3fd72df6f77208fbfe3086e818e650b55dde021e 100644 GIT binary patch delta 6198 zcmZu#3sh9~)<1igfx$pPkcWT_F9lJ8EBF8(gD_&rGevorJV$3_7{*};BNJUng)9`> zH~*-Zqh)#3y4koyKW{gREd6d4C7*At@4LG0l-{JW@|E-L|Ct#ct$Wrw=lu6?KYn}f z|6>k(vCs93eXbp^NIX91+>#?H4(Po67Hq~%kP8EruV6JmAI^4p2)&prT?*B>MLGkL z@FQs;1mk6CB7BD)vP{ptYX#vmX_P>hbuO04LZJaS$bz8+cgiNhdw4tLKl#@;DYpm~|OF+Qut+ z6mM(VQi^TA=-VVAl!PM+`Wzo zb3E%OP>dD4gFikicGJkmH&GcBF!`(%{s1m8#e^CO$z3EihB1C zQC;koV$|PO;FA;lCx1h96i5tvj>f}bPuVqM*b}Impl!+}r1?eph9+NnhHdbqwE1kz z;%?OhjmV!@L19IvK(1d*`Z2@xN$q-(_Ff6;MpmOhzq!dr0h5a@gSq+~=oA6O;S5OD7IU+E>r4+39uMT^! z!*}K^gK(72jhFm18Bv^tU z&utmoKFe;qo8H!5OToMX7yKYC30}gV(&Aw`hA+@Z6eihiH1uv$`SB@x#@bB6j^AGN zXe}7DHsFy3C1WEAp$r$iO&Ly3!u*WT6gff7s=GjkSgOin{dH1{C0nNto8I7K)m=(c zx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`-;x zUuGa?72jweT^Bz`l1yphj}4Fr_j$rn+9Ir9A`|_n;l06&s&%HN<&~TG%B8d&_58Yc zY~{Jjs6%)9Ija0=&GVN@LG!4v{=SlC)e_bZ6kJK`l8+Edu|6|f?dWlUH zWfd!QRoD2DG742MDMTa0FJLe&0S@JGf-?HNoEYo*4SM+2_Czc)(ced8YUN=@>UlhW z(MZHG+FgZ%uYh7MkR#s8M3VIMh6RM&)3 zRnneiCca=fyh~fyr%FmENj%#5+$vZNclfy~BEQB%s|mc%)2nHMG<;<>CDzXWTYzi% OA3{3cnQMYSgZ~dM*)`$- diff --git a/build/test/results/test_duellist_spielesammlung_projekt.pass b/build/test/results/test_duellist_spielesammlung_projekt.pass deleted file mode 100644 index 43b42bd..0000000 --- a/build/test/results/test_duellist_spielesammlung_projekt.pass +++ /dev/null @@ -1,118 +0,0 @@ ---- -:source: - :path: src/test - :file: test_duellist_spielesammlung_projekt.c -:successes: -- :test: test_coinflip_x_starts - :line: 11 - :message: '' - :unity_test_time: 0 -- :test: test_coinflip_o_starts - :line: 23 - :message: '' - :unity_test_time: 0 -- :test: test_vertical_win - :line: 35 - :message: '' - :unity_test_time: 0 -- :test: test_horizontal_win - :line: 49 - :message: '' - :unity_test_time: 0 -- :test: test_diagonal_win - :line: 62 - :message: '' - :unity_test_time: 0 -- :test: test_valid_move_and_switch - :line: 76 - :message: '' - :unity_test_time: 0 -- :test: test_invalid_input - :line: 92 - :message: '' - :unity_test_time: 0 -- :test: test_valid_input - :line: 106 - :message: '' - :unity_test_time: 0 -- :test: test_invalid_input_negative_row - :line: 121 - :message: '' - :unity_test_time: 0 -- :test: test_invalid_input_overflow_column - :line: 135 - :message: '' - :unity_test_time: 0 -- :test: test_NumberOfMoves_returns_correct_number_of_moves - :line: 149 - :message: '' - :unity_test_time: 0 -- :test: test_BoardFull_returns_false_when_board_is_not_full - :line: 163 - :message: '' - :unity_test_time: 0 -- :test: test_BoardFull_returns_true_when_board_is_full - :line: 176 - :message: '' - :unity_test_time: 0 -- :test: test_CurrentPlayer_returns_correct_player - :line: 189 - :message: '' - :unity_test_time: 0 -- :test: test_FieldEmpty_returns_true_for_empty_field - :line: 202 - :message: '' - :unity_test_time: 0 -- :test: test_FieldEmpty_returns_false_for_nonempty_field - :line: 215 - :message: '' - :unity_test_time: 0 -- :test: test_calculate_mines_HeightWidthOne - :line: 228 - :message: '' - :unity_test_time: 0 -- :test: test_calculate_mines_WidthOne - :line: 242 - :message: '' - :unity_test_time: 0 -- :test: test_calculate_mines_NormalCase - :line: 256 - :message: '' - :unity_test_time: 0 -- :test: test_end_check_AllUncovered_NoMines - :line: 270 - :message: '' - :unity_test_time: 0 -- :test: test_create_minefield_ValidDimensions - :line: 289 - :message: '' - :unity_test_time: 0 -- :test: test_calculate_mines_HeightOne - :line: 314 - :message: '' - :unity_test_time: 0 -- :test: test_create_minefield_NegativeDimensions - :line: 328 - :message: '' - :unity_test_time: 0 -- :test: test_calculate_mines_HeightZero - :line: 342 - :message: '' - :unity_test_time: 0 -- :test: test_calculate_mines_HeightWidthNumber - :line: 356 - :message: '' - :unity_test_time: 0 -- :test: test_calculate_mines_HeightWidthAgan - :line: 370 - :message: '' - :unity_test_time: 0 -:failures: [] -:ignores: [] -:counts: - :total: 26 - :passed: 26 - :failed: 0 - :ignored: 0 -:stdout: [] -:time: 0.05033430000003136 diff --git a/src/main/duellist-spielesammlung-projekt.c b/src/main/duellist-spielesammlung-projekt.c index bac07f6..fd1ccd8 100644 --- a/src/main/duellist-spielesammlung-projekt.c +++ b/src/main/duellist-spielesammlung-projekt.c @@ -8,6 +8,7 @@ #define unknown_character 'x' #define mine_character '@' + int checkAge(int age) { return age >= MIN_AGE ? 1 : 0; } @@ -138,16 +139,17 @@ GameResult checkGameResult(const TicTacToeGame* game) { return draw ? GAME_DRAW : SUCCESS; } + //Nach eingabe zurberechnung der Minen anzahl int calculate_mines(int height, int width) { - int num_mines; + int number_mines; if (height <= 1 || width <= 1) { return 0; } else { - num_mines = ((height * width) / 4); + number_mines = ((height * width) / 4); } - return num_mines; + return number_mines; } //Zum erstellen des Spielfeldes From b8387c6e9bb898c7565ad2b7af01c7a4de5a53b9 Mon Sep 17 00:00:00 2001 From: Daniel M Date: Thu, 8 Feb 2024 12:49:44 +0100 Subject: [PATCH 6/7] =?UTF-8?q?refactoring=20:=20Makierte=20Kommetar=20beg?= =?UTF-8?q?r=C3=A4zung=20zwischen=20dem=20Spiel=20Code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../out/c/duellist-spielesammlung-projekt.o | Bin 13924 -> 13950 bytes .../test_duellist_spielesammlung_projekt.out | Bin 102734 -> 102734 bytes .../test_duellist_spielesammlung_projekt.pass | 118 ++++++++++++++++++ src/main/duellist-spielesammlung-projekt.c | 2 + 4 files changed, 120 insertions(+) create mode 100644 build/test/results/test_duellist_spielesammlung_projekt.pass diff --git a/build/test/out/c/duellist-spielesammlung-projekt.o b/build/test/out/c/duellist-spielesammlung-projekt.o index 4c746690c278380c87d9d4cc48156adc053b9453..c49dce172f7455af5a55a0aeb2d259bc43b5777c 100644 GIT binary patch delta 2940 zcmY*bZERCj7(S0loWvowmzCL14dYoPdIMVTuog&! z#Q28@JbJ~Mh9~5iZE;~zIO=?vRiJ4zJ;gy zkh(#n{-sj47^&_?INRamJv}GOC)|FJ&74F}TO~ONvud4~TG!6bfn6aCy_36sz*sin zpQc~P&5owiP}f~i8M!X2JcH;qu8eYBhO&DWWFse0u3M5C%&Mn`t>ez&*hI-i79uIY~ zSx;R>F%MgS??d>~bhX%et$padfHhS+XhEjEdXcGM98a(8=NcQSIf+L|P3=B9zduY& zW@_DO?Mr6feK=)y^BaY<7TR7lwG~*RU*wyyv#LQ&UbcRf4h z^O%YX*%eT(g`-(FcW%Y`HWQ|fF85dMs1W4)~RNP_3{VTb0>=ctd8@L)s3U+4P^~b4x z2?HuaeJhy(S_Cwo+*h0nCz|v&DD=ES8j#F*PjR0p?wsO&Qpkd{LFzex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U_6S2$nk|@dBk=WTs=zh<|HP6orBh$ikfRYuVp!8EOCuxTE7BvhI_-YuwM)B42rG5c!k^qNTCj28=ebl z6I7UKJRic@jIZcxmGQRE!KWJMeC6C@T=)5Sv0*E#nNc9Bn27IWe0icw?zIJ*p`R-} z;v>8~QR0_mvb(I(l0SsUQtETbI9Ps^=OpJ(+08BCaPsqq;#QAWco$5tJ!fgn&s={l z&x#FJ2I_UR<#}VUdJ3;M4psa3TgH3%Z8mJ zmF^$%-XX6Ow~Q*<4Wv}26W0Kw`XR1I6&E7zARey`aw5ldf@gtL;AcQ;@Hlaofy5Q! zV80M|o#Jj0cbnqMu(6b01(4EPN8A%YqG;p5G^hRz(c=_)gSeYOD)n9BECngaRX{4u z8X(n&oy6(H{Z8DU#5LOGSSvQroaBPq*SJ1{9#x{OTy`GF36#Yy5_gNZ0$g*-TS2IU zPyk4&9477!;>L*kn$R7EbfnA0Euscj1F0ms$JZ(8nIBs%$mf)0&*Mc8>{Nwe8`B@@5>Z#!wU`Gu$f;;h8v19{sZq**aH9n diff --git a/build/test/out/test_duellist_spielesammlung_projekt.out b/build/test/out/test_duellist_spielesammlung_projekt.out index 3fd72df6f77208fbfe3086e818e650b55dde021e..5b310facdbf1861c2ff9f180203e4990471364d3 100644 GIT binary patch delta 6013 zcmZu#2~<>9(!SMnLyMpwTeGz63Ze)BBC=>Bv@0MesNjMKt=+PU&4@7y93)YRzhFh5 z3o6E#F^UG4`c2gwfBKfeU3yco)~me4zw)$fo+TD#jXqks3QP8QYuG ztYYh>Ax6V2@_mgaS{#X{r5(zUdrc0BDinF*FvvY{~ zc8~Gmbh6~2&OT^BAlcXZg&2?E`}V2u0Kc=Zfm4|6pona!6w}z(PD)>rl3N>bkf#}! zum6IB;TEtQ1&3&=^rC|=1mGQqO1O-(H;6FVU!ETK8ybklw)yosq80OUi3d3K$3L(^c0b}=9QuyHGEXldrhdAc( z-T~qCO#NcU-%#c4HT=eW5g}D({3ku%kGA@rHCt-9r4!e9Hw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tP?CV=?p;coZd zg(}XAehyUTosY)2!e#u+lQ7Bo#VXDdW1j}d@@q8}9GrVZ^UfeVjiL{paZkt7XJO&f zXfR^q(;4(x*z>el^l%X>p6Or?ZhN*FdQtW~LH3M(fAp0qZXf;e!BZgGT=zU1Kxh8s z#bSk=eG>VPq2IdUBi$t~>$j+|ZS}P?fl%fry-7a|BCeg|^Cp28zdjyz!LV-GtI!A{ zt+u;;B0O+`UVi&z=mmZEqA75cen;K+OoJdADyP9-uZEA4Y3pzy#KNA_wA9s9y#eG? zLhcPgt`M?THQ48SLZ+q;(G44A95*Lpupkoha0v1?At{-IeLf<@ zI0U&#Nc#}vF(HSCAaV~{&>_gUD1y!pfl>&$>_i;d_45DBr4@O^ugZg!pyF@k!7fo> zCSN@d!dSbTwXM0r7+U%3^B^5eeCT`#kL=BJL|#%-QdLG*bO_xcwq+2mHIfw|sdu5@(_EcQ!6dYp(uCytNFhjcF!{omQp0806$ ze9A9|_bGsM(K9)}qyWM|&o>spRY^w?x$}?${(NTvWbi%NAcn8`3x!k)9UosrGfYLc z)J=RR8+sPohMv58F@!@LKYlfo-8a(Mv{f+@?y06H81-h+gYJ9BJh8 zCyGg>S8G%0<^2}I%BtKNhaa11qM4qn1|waBlnz186Y|~=o`G zAd#9K)I|C-Cg&k`^W?bo0>Unbl4S;shEgl#e_%6?@yca1{~DjN42mI_-@gnJz1oM! zNab|8`0tsUf4AFmhzBpJQ=mj&XC!YfgwLp??b^d*C9!h+#Y(sUQht|~!1ws8S_l_C zuH~O=AptCW{0iFAea?EYO3(DBnhmg))M|_?s`Q)qH7jU;6!CXivyIPN3E^Jf4T;X* zhxRDHl?*V2Ke3YJIQ|i9rtnERD2_Zk#QQmU#|_9BYjidB8bdGtzK+t?3kFss_W1eI zn(= MIN_AGE ? 1 : 0; @@ -139,6 +140,7 @@ GameResult checkGameResult(const TicTacToeGame* game) { return draw ? GAME_DRAW : SUCCESS; } +/*--------------------Minsweeper--------------------*/ //Nach eingabe zurberechnung der Minen anzahl int calculate_mines(int height, int width) { From dd1634f199a3652cf76de5d20c88593f8a5d33db Mon Sep 17 00:00:00 2001 From: Daniel M Date: Thu, 8 Feb 2024 12:54:55 +0100 Subject: [PATCH 7/7] =?UTF-8?q?refactoring=20:=20Entfern=20und=20hinzuf?= =?UTF-8?q?=C3=BCgen=20von=20weiteren=20kommetaren=20um=20besser=20die=20f?= =?UTF-8?q?untionen=20der=20einzellnen=20funtionen=20zu=20erkennen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/duellist-spielesammlung-projekt.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/main/duellist-spielesammlung-projekt.c b/src/main/duellist-spielesammlung-projekt.c index 581eb41..62c5597 100644 --- a/src/main/duellist-spielesammlung-projekt.c +++ b/src/main/duellist-spielesammlung-projekt.c @@ -226,7 +226,7 @@ void show_minefield(char** minefield, int height, int width) { int field_check(char** minefield, char** mines, int height, int width, int row, int column) { char counter = 0; if ((row < 0) || (row >= height) || (column < 0) || (column >= width)) { - printf("Exception: Outside the minefield!\n"); + printf("Auserhalb des Minenfeldes!\n"); return -1; } @@ -303,7 +303,6 @@ int end_check(char** minefield, char** mines, int height, int width) { int i, j; for (i = 0; i < height; i++) { for (j = 0; j < width; j++) { - // If a field is not uncovered and does not contain a mine, the game is not over if ((mines[i][j] == 0) && (minefield[i][j] == unknown_character)) { return 0; } @@ -315,7 +314,6 @@ int end_check(char** minefield, char** mines, int height, int width) { //befreie anliegendes Feld void free_minefield(char** minefield, int height) { int i; - // Free each vector for (i = 0; i < height; i++) { free(minefield[i]); } @@ -323,6 +321,7 @@ void free_minefield(char** minefield, int height) { minefield = NULL; } +//Start des Spiels int minesweeper() { int height, width, row, column; printf("Geben Sie die Grösse des spielfeldes ein:\n"); @@ -338,7 +337,6 @@ int minesweeper() { printf("Das spielfeld hat eine groesse von >%d< und eine breite von: >%d<.\n", height, width); printf("Es gibt %d Minen auf dem Spielfeld.\n", num_mines); - // Matrix for the game field char** minefield = create_minefield(height, width, unknown_character); char** mines = create_minefield(height, width, 0); @@ -352,11 +350,10 @@ int minesweeper() { } row--; column--; - // Quit + if ((row == -1) && (column == -1)) { break; } - // Check field boundaries if (row >= height || row < 0) { printf("hoehe zwischen 1 und %d!\n", height); continue; @@ -366,21 +363,18 @@ int minesweeper() { 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("höhe: %d breite: %d war leider eine 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("Sie haben es erfolgreich geloesst!\n"); break; } - // Show current field to continue playing + else { show_minefield(mines, height, width); }