From 87a0eeb974b70741817dd5f4048d4cb694375395 Mon Sep 17 00:00:00 2001 From: Emman Mensdorf Date: Thu, 8 Feb 2024 16:20:43 +0100 Subject: [PATCH] Main.c komplete fertig, Emman Mensdorf --- src/main.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/src/main.c b/src/main.c index 0ca7bf3..2eb891d 100644 --- a/src/main.c +++ b/src/main.c @@ -21,7 +21,46 @@ int main() { + char** Spielbrett = Schachbrett_erstellen(); + int** SpielHistorie = erstellen_historie(); + + int anzahl_Zuege = 0; + + print_Schachfeld(Spielbrett); + Player player = PLAYER_WHITE; + if(player == PLAYER_WHITE){ + int kingX = -1, kingY = -1; + + for (int y = 0; y < 8; y++) { + for (int x = 0; x < 8; x++) { + if ((Spielbrett[y][x] == 'K' )) { + kingX = x; + kingY = y; + } + } + } + + while(istSchachmatt(Spielbrett,kingX,kingY,player)){ + + char* StartX = getUserInput(); + char* StartY = getUserInput(); + char* endX = getUserInput(); + char* endY = getUserInput(); + + machezug(Spielbrett, StartX,StartY,endX,endY,player); + hinzufuegen_historie(SpielHistorie,StartX,StartY,endX,endY,player,anzahl_Zuege); + + if(player == PLAYER_WHITE){ + player = PLAYER_BLACK; + }else{ + player = PLAYER_WHITE; + } + anzahl_Zuege++; + + print_Schachfeld(Spielbrett); + } + print_Historie(SpielHistorie,anzahl_Zuege); }