|
@ -140,23 +140,6 @@ bool GreiftLaeuferAn(char** Brett, int x, int y, Player player) { |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
bool istFeldUnsicher(char** Brett, int x, int y, Player player) { |
|
|
|
|
|
|
|
|
|
|
|
if (GreiftSpringerAn(Brett, x, y, player)) { |
|
|
|
|
|
return true; |
|
|
|
|
|
} |
|
|
|
|
|
if (GreiftBauerAn(Brett, x, y, player)) { |
|
|
|
|
|
return true; |
|
|
|
|
|
} |
|
|
|
|
|
if (GreiftTurmAn(Brett, x, y, player)) { |
|
|
|
|
|
return true; |
|
|
|
|
|
} |
|
|
|
|
|
if (GreiftLaeuferAn(Brett, x, y, player)) { |
|
|
|
|
|
return true; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
bool GreiftDameAn(char** Brett, int x, int y, Player player) { |
|
|
bool GreiftDameAn(char** Brett, int x, int y, Player player) { |
|
|
char Dame = player == PLAYER_WHITE ? 'q' : 'Q'; |
|
|
char Dame = player == PLAYER_WHITE ? 'q' : 'Q'; |
|
|
|
|
|
|
|
@ -179,6 +162,53 @@ bool GreiftDameAn(char** Brett, int x, int y, Player player) { |
|
|
|
|
|
|
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
|
|
|
bool GreiftKoenigAn(char** Brett, int x, int y, Player player) { |
|
|
|
|
|
// Mögliche Züge eines Königs |
|
|
|
|
|
int koenigZuege[8][2] = { |
|
|
|
|
|
{1, 0}, {-1, 0}, |
|
|
|
|
|
{0, 1}, {0, -1}, |
|
|
|
|
|
{1, 1}, {1, -1}, |
|
|
|
|
|
{-1, 1}, {-1, -1} |
|
|
|
|
|
}; |
|
|
|
|
|
char gegnerischerKoenig = (player == PLAYER_WHITE) ? 'k' : 'K'; |
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < 8; i++) { |
|
|
|
|
|
int neuX = x + koenigZuege[i][0]; |
|
|
|
|
|
int neuY = y + koenigZuege[i][1]; |
|
|
|
|
|
if (neuX >= 0 && neuX < 8 && neuY >= 0 && neuY < 8) { |
|
|
|
|
|
if (Brett[neuY][neuX] == gegnerischerKoenig) { |
|
|
|
|
|
return true; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool istFeldUnsicher(char** Brett, int x, int y, Player player) { |
|
|
|
|
|
|
|
|
|
|
|
if (GreiftSpringerAn(Brett, x, y, player)) { |
|
|
|
|
|
return true; |
|
|
|
|
|
} |
|
|
|
|
|
if (GreiftBauerAn(Brett, x, y, player)) { |
|
|
|
|
|
return true; |
|
|
|
|
|
} |
|
|
|
|
|
if (GreiftTurmAn(Brett, x, y, player)) { |
|
|
|
|
|
return true; |
|
|
|
|
|
} |
|
|
|
|
|
if (GreiftLaeuferAn(Brett, x, y, player)) { |
|
|
|
|
|
return true; |
|
|
|
|
|
} |
|
|
|
|
|
if (GreiftDameAn(Brett, x, y, player)) { |
|
|
|
|
|
return true; |
|
|
|
|
|
} |
|
|
|
|
|
if (GreiftKoenigAn(Brett, x, y, player)) { |
|
|
|
|
|
return true; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool istzugerlaubt_Koenig(char** Brett, int startX, int startY, int endX, int endY, Player player) { |
|
|
bool istzugerlaubt_Koenig(char** Brett, int startX, int startY, int endX, int endY, Player player) { |
|
|
// Schauen ob der zug auf dem Spielbrett passiert |
|
|
// Schauen ob der zug auf dem Spielbrett passiert |
|
|