|
|
@ -6,6 +6,35 @@ |
|
|
|
#include "Moving.h" |
|
|
|
#include "Koenig.h" |
|
|
|
|
|
|
|
bool GreiftSpringerAn(char** Brett, int x, int y, Player player) { |
|
|
|
int Springerzüge[8][2] = { |
|
|
|
{2, 1}, {1, 2}, {-1, 2}, {-2, 1}, |
|
|
|
{-2, -1}, {-1, -2}, {1, -2}, {2, -1} |
|
|
|
}; |
|
|
|
|
|
|
|
for (int i = 0; i < 8; i++) { |
|
|
|
int neuX = x + Springerzüge[i][0]; |
|
|
|
int neuY = y + Springerzüge[i][1]; |
|
|
|
if (neuX >= 0 && neuX < 8 && neuY >= 0 && neuY < 8) { |
|
|
|
char Figur = Brett[neuY][neuX]; |
|
|
|
if (player == PLAYER_WHITE && Figur == 'n') { |
|
|
|
return true; |
|
|
|
} else if (player == PLAYER_BLACK && Figur == 'N') { |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return false; |
|
|
|
} |
|
|
|
bool istFeldUnsicher(char** Brett, int x, int y, Player player) { |
|
|
|
|
|
|
|
if (GreiftSpringerAn(Brett, x, y, player)) { |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
bool istzugerlaubt_Koenig(char** Brett, int startX, int startY, int endX, int endY, Player player) { |
|
|
|
// Schauen ob der zug auf dem Spielbrett passiert |
|
|
|
if (endX < 0 || endX >= 8 || endY < 0 || endY >= 8) |
|
|
|