From 755948f0b419cd7a392e2f24990ffc907fcbabe6 Mon Sep 17 00:00:00 2001 From: Jannis Date: Sat, 4 Feb 2023 15:22:32 +0100 Subject: [PATCH] Refactoring lose&feldFrei --- .vscode/c_cpp_properties.json | 17 +++++++++++++++++ src/Umgebung | Bin 20320 -> 20304 bytes src/Umgebung.c | 18 +++++++++--------- 3 files changed, 26 insertions(+), 9 deletions(-) create mode 100644 .vscode/c_cpp_properties.json diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..847ee83 --- /dev/null +++ b/.vscode/c_cpp_properties.json @@ -0,0 +1,17 @@ +{ + "configurations": [ + { + "name": "Linux", + "includePath": [ + "${workspaceFolder}/**", + "UnityTest/src" + ], + "defines": [], + "compilerPath": "/usr/bin/gcc", + "cStandard": "gnu17", + "cppStandard": "gnu++17", + "intelliSenseMode": "linux-gcc-x64" + } + ], + "version": 4 +} \ No newline at end of file diff --git a/src/Umgebung b/src/Umgebung index 4de14da83c93ba24eff535ec81323a74903a246f..7251b25ff5a3f66e558e828ff47a66c860d84e30 100755 GIT binary patch delta 1555 zcmY*YZA@EL7(VB;r}y4|)AH4>IJz&_Ne7HJ42E_LnzS$&L{vzK17$Ff8OM4}rXeWJ zjI4vuoS0y&WLq}PSTxFwQ-8TFOCZshsSBBz#{MyZI1GvWz=T=fb8jp2Bz@oKJn!?o z_uTi~rf2cpSvkxuE+o zpRG8pY^2!dtB6dD-k(@|H+*j){E%B0!W%rTTvzd?ijxr8uTD2BbsJ2Zk(q>kye9l` z^rakU(YU9R7@=4&$1;zr#BG~8k;!D@;SC%g-Ei8bnql|W=sj6}nH_UIDda52Ts}w4 z_!aokiWwqE`s5CF&E@xd65+MU2u?h=9!Z4nPkbMlSXkcu5A@u?a@H{qHgF8fZS1&v zM_?JNM?7~^2JiZ0TPD%6w&nfqk>(ZDr~T0l#u2$4jDC+M$N!VdS-EoET}kIlV+4;Y z@{TcF)x<{=w%Xqz4Hg5bHwz*{9-uD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%$<$y9T1h^F1$|goSZ;J6A-mC}x#0~k4q7qrWiR(X<0n#eL5y)C z$CppSo*HTvUDQfSbE!B%ExV}v5yd^!UqdA^!VTRR&FZ0aj9ROygVW>*x~)fpmW%zg z5D^`Dk2*l%R?Rw0?V6<*jI%VmpE|_5y!uO;x0ow&mRi~Ej4T_ groesste){ - groesste = realU1[i][j]; + if (realU[i][j] > groesste && realU[i][j] != (N * N) + 1){ + groesste = realU[i][j]; ii = i; jj = j; } @@ -163,25 +163,25 @@ int lose(int realU[N][N], int realU1[N-1][N-1], char richtung){ } //Ueberpruefe ob eine Bewegung nach oben moeglich ist if(richtung == 'u'){ - if(realU[ii - 1][jj] != 0 || feldFrei(realU1, ii-1, jj) == 1){ + if(realU[ii - 1][jj] != (N* N) + 1 && feldFrei(realU[N][N], ii-1, jj) == 1){ return 1; } } //Ueberpruefe ob eine Bewegung nach unten moeglich ist if(richtung == 'd'){ - if(realU[ii + 1][jj] != N || feldFrei(realU1, ii+1, jj) == 1){ + if(realU[ii + 1][jj] != N || feldFrei(realU, ii+1, jj) == 1){ return 1; } } //Ueberpruefe ob eine Bewegung nach links moeglich ist if(richtung == 'l'){ - if(realU[ii][jj-1] != 0 || feldFrei(realU1, ii, jj-1) == 1){ + if(realU[ii][jj-1] != 0 || feldFrei(realU, ii, jj-1) == 1){ return 1; } } //Ueberpruefe ob eine Bewegung nach rechts moeglich ist if(richtung == 'r'){ - if(realU[ii][jj + 1] > N || feldFrei(realU1, ii, jj+1) == 1){ + if(realU[ii][jj + 1] > N || feldFrei(realU, ii, jj+1) == 1){ return 1; } }