Browse Source

Main.c komplete fertig, Emman Mensdorf

main
Emman Mensdorf 11 months ago
parent
commit
87a0eeb974
  1. 39
      src/main.c

39
src/main.c

@ -21,7 +21,46 @@
int main() { 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);
} }
Loading…
Cancel
Save