You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.0 KiB
39 lines
1.0 KiB
#include <stdbool.h>
|
|
#include <stdio.h>
|
|
#include "Moving.h"
|
|
#include "Schachbrett.h"
|
|
#include "Spieler.h"
|
|
|
|
bool king_alive(char** brett) {
|
|
bool white_king_found = false;
|
|
bool black_king_found = false;
|
|
|
|
for(int i = 0; i < 8; i++) {
|
|
for(int j = 0; j < 8; j++) {
|
|
if(brett[i][j] == 'K') {
|
|
white_king_found = true;
|
|
} else if(brett[i][j] == 'k') {
|
|
black_king_found = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
return white_king_found && black_king_found;
|
|
}
|
|
// Züge von jedem Spieler zählen, bis der König besiegt wurde
|
|
void anzahl_Zuege(char** brett, Player player) {
|
|
int count_WHITE = 0, count_BLACK = 0;
|
|
if(king_alive(brett)) {
|
|
if (player == PLAYER_WHITE){
|
|
count_WHITE++;
|
|
}
|
|
if (player == PLAYER_BLACK){
|
|
count_BLACK++;
|
|
}
|
|
}
|
|
else {
|
|
printf("Spieler Weiß hat %d Züge gebraucht und Spieler Schwarz %d!\n");
|
|
|
|
}
|
|
}
|
|
// Während der Laufzeit des Spiels neue Features hinzufügen
|