|
@ -28,6 +28,51 @@ bool GreiftBauerAn(char** Brett, int x, int y, Player player) { |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool GreiftTurmAn(char** Brett, int x, int y, Player player) { |
|
|
|
|
|
char Turm = player == PLAYER_WHITE ? 'r' : 'R'; |
|
|
|
|
|
|
|
|
|
|
|
// Check Vertikal Hoch |
|
|
|
|
|
for (int i = y - 1; i >= 0; i--) { |
|
|
|
|
|
if (Brett[i][x] != ' ') { |
|
|
|
|
|
if (Brett[i][x] == Turm) { |
|
|
|
|
|
return true; |
|
|
|
|
|
} |
|
|
|
|
|
break; // Stoppt wenn irgendeine Figur gefunden wird |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Vertikal Runter |
|
|
|
|
|
for (int i = y + 1; i < 8; i++) { |
|
|
|
|
|
if (Brett[i][x] != ' ') { |
|
|
|
|
|
if (Brett[i][x] == Turm) { |
|
|
|
|
|
return true; |
|
|
|
|
|
} |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Horizontal Links |
|
|
|
|
|
for (int j = x - 1; j >= 0; j--) { |
|
|
|
|
|
if (Brett[y][j] != ' ') { |
|
|
|
|
|
if (Brett[y][j] == Turm) { |
|
|
|
|
|
return true; |
|
|
|
|
|
} |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Horizontal Rechts |
|
|
|
|
|
for (int j = x + 1; j < 8; j++) { |
|
|
|
|
|
if (Brett[y][j] != ' ') { |
|
|
|
|
|
if (Brett[y][j] == Turm) { |
|
|
|
|
|
return true; |
|
|
|
|
|
} |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
bool GreiftSpringerAn(char** Brett, int x, int y, Player player) { |
|
|
bool GreiftSpringerAn(char** Brett, int x, int y, Player player) { |
|
|
int Springerzüge[8][2] = { |
|
|
int Springerzüge[8][2] = { |
|
|
{2, 1}, {1, 2}, {-1, 2}, {-2, 1}, |
|
|
{2, 1}, {1, 2}, {-1, 2}, {-2, 1}, |
|
@ -56,6 +101,9 @@ bool istFeldUnsicher(char** Brett, int x, int y, Player player) { |
|
|
if (GreiftBauerAn(Brett, x, y, player)) { |
|
|
if (GreiftBauerAn(Brett, x, y, player)) { |
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
} |
|
|
|
|
|
if (GreiftTurmAn(Brett, x, y, player)) { |
|
|
|
|
|
return true; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|