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
56 lines
1.3 KiB
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <stdbool.h>
|
|
#include "spieler.h"
|
|
#include "Moving.h"
|
|
#include "Bauer.h"
|
|
|
|
bool istzugerlaubt_Bauer(char** Brett, int startX, int startY, int endX, int endY, Player player) {
|
|
//Bauern ZUG und Funktionen
|
|
//Wichtig extra Funktion EN Passaut
|
|
//Wichtig Bauernumwandlung
|
|
|
|
|
|
if (player == PLAYER_WHITE){
|
|
|
|
if((startY + 1 == endY) && ((startX + 1 == endX) ||(startX - 1 == endY)) && ((Brett[endY][endX] == 'p') || (Brett[endY][endX] == 'n') || (Brett[endY][endX] == 'b') ||
|
|
(Brett[endY][endX] == 'q') || (Brett[endY][endX] == 'r')))
|
|
{
|
|
return true;
|
|
}
|
|
|
|
|
|
if(startX != endX){
|
|
return false;
|
|
}
|
|
|
|
if ((startY + 1 ) == endY|| ((startY == 1) && (startY + 2 == endY))){
|
|
return true;
|
|
}else {
|
|
return false;
|
|
}
|
|
|
|
}
|
|
else{
|
|
if((startY - 1 == endY) && ((startX + 1 == endX) ||(startX - 1 == endY)) && ((Brett[endY][endX] == 'P') || (Brett[endY][endX] == 'N') || (Brett[endY][endX] == 'B') ||
|
|
(Brett[endY][endX] == 'Q') || (Brett[endY][endX] == 'R')))
|
|
{
|
|
return true;
|
|
}
|
|
|
|
|
|
if(startX != endX){
|
|
return false;
|
|
}
|
|
|
|
if ((startY - 1 ) == endY|| ((startY == 6) && (startY - 2 == endY))){
|
|
return true;
|
|
}else {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
return true;
|
|
}
|
|
|