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

1 year ago
  1. #include <stdbool.h>
  2. #include <stdio.h>
  3. #include "Moving.h"
  4. #include "Schachbrett.h"
  5. #include "Spieler.h"
  6. bool king_alive(char** brett) {
  7. bool white_king_found = false;
  8. bool black_king_found = false;
  9. for(int i = 0; i < 8; i++) {
  10. for(int j = 0; j < 8; j++) {
  11. if(brett[i][j] == 'K') {
  12. white_king_found = true;
  13. } else if(brett[i][j] == 'k') {
  14. black_king_found = true;
  15. }
  16. }
  17. }
  18. return white_king_found && black_king_found;
  19. }
  20. // Züge von jedem Spieler zählen, bis der König besiegt wurde
  21. void anzahl_Zuege(char** brett, Player player) {
  22. int count_WHITE = 0, count_BLACK = 0;
  23. if(king_alive(brett)) {
  24. if (player == PLAYER_WHITE){
  25. count_WHITE++;
  26. }
  27. if (player == PLAYER_BLACK){
  28. count_BLACK++;
  29. }
  30. }
  31. else {
  32. printf("Spieler Weiß hat %d Züge gebraucht und Spieler Schwarz %d!\n");
  33. }
  34. }
  35. // Während der Laufzeit des Spiels neue Features hinzufügen