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.

56 lines
1.3 KiB

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <stdbool.h>
  4. #include "spieler.h"
  5. #include "Moving.h"
  6. #include "Bauer.h"
  7. bool istzugerlaubt_Bauer(char** Brett, int startX, int startY, int endX, int endY, Player player) {
  8. //Bauern ZUG und Funktionen
  9. //Wichtig extra Funktion EN Passaut
  10. //Wichtig Bauernumwandlung
  11. if (player == PLAYER_WHITE){
  12. if((startY + 1 == endY) && ((startX + 1 == endX) ||(startX - 1 == endY)) && ((Brett[endY][endX] == 'p') || (Brett[endY][endX] == 'n') || (Brett[endY][endX] == 'b') ||
  13. (Brett[endY][endX] == 'q') || (Brett[endY][endX] == 'r')))
  14. {
  15. return true;
  16. }
  17. if(startX != endX){
  18. return false;
  19. }
  20. if ((startY + 1 ) == endY|| ((startY == 1) && (startY + 2 == endY))){
  21. return true;
  22. }else {
  23. return false;
  24. }
  25. }
  26. else{
  27. if((startY - 1 == endY) && ((startX + 1 == endX) ||(startX - 1 == endY)) && ((Brett[endY][endX] == 'P') || (Brett[endY][endX] == 'N') || (Brett[endY][endX] == 'B') ||
  28. (Brett[endY][endX] == 'Q') || (Brett[endY][endX] == 'R')))
  29. {
  30. return true;
  31. }
  32. if(startX != endX){
  33. return false;
  34. }
  35. if ((startY - 1 ) == endY|| ((startY == 6) && (startY - 2 == endY))){
  36. return true;
  37. }else {
  38. return false;
  39. }
  40. }
  41. return true;
  42. }