Wieder recht close an gut, aber immer noch keine schöne Darstellung des Spielbretts
This commit is contained in:
parent
705c505982
commit
41803c5ef3
79
main.cpp
79
main.cpp
@ -14,10 +14,34 @@ int main() {
|
||||
const std::string horizontal = "─", vertical = "│";
|
||||
const std::string topIntersection = "┬", bottomIntersection = "┴", middleIntersection = "┼";
|
||||
|
||||
const std::string whiteSquare = "□"; // Weißes Feld
|
||||
const std::string blackSquare = "■"; // Schwarzes Feld
|
||||
const std::string whiteSquare = "\u25A1";
|
||||
const std::string whiteKing = "\u2654";
|
||||
const std::string whiteQueen = "\u2655";
|
||||
const std::string whiteRook = "\u2656";
|
||||
const std::string whiteBischop = "\u2657";
|
||||
const std::string whiteKnight = "\u2658";
|
||||
const std::string whitePawn = "\u2659";
|
||||
|
||||
const int boardSize = 8; // Schachbrettgröße
|
||||
const std::string blackSquare = "\u25A0";
|
||||
const std::string blackKing = "\u265A";
|
||||
const std::string blackQueen = "\u265B";
|
||||
const std::string blackRook = "\u265C";
|
||||
const std::string blackBischop = "\u265D";
|
||||
const std::string blackKnight = "\u265E";
|
||||
const std::string blackPawn = "\u265F";
|
||||
|
||||
const int boardSize = 8;
|
||||
|
||||
int brett[8][8] = {
|
||||
{201, 202, 203, 204, 205, 203, 202, 201},
|
||||
{200, 200, 200, 200, 200, 200, 200, 200},
|
||||
{1, 2, 1, 2, 1, 2, 1, 2},
|
||||
{2, 1, 2, 1, 2, 1, 2, 1},
|
||||
{1, 2, 1, 2, 1, 2, 1, 2},
|
||||
{2, 1, 2, 1, 2, 1, 2, 1},
|
||||
{100, 100, 100, 100, 100, 100, 100, 100},
|
||||
{101, 102, 103, 104, 105, 103, 102, 101}
|
||||
};
|
||||
|
||||
// Obere Rahmenlinie
|
||||
std::cout << topLeft;
|
||||
@ -32,12 +56,44 @@ int main() {
|
||||
for (int subRow = 0; subRow < 1; ++subRow) {
|
||||
std::cout << vertical;
|
||||
for (int col = 0; col < boardSize; ++col) {
|
||||
if ((row + col) % 2 == 0) {
|
||||
switch (brett[row][col]) {
|
||||
case 1: std::cout << " " << whiteSquare << " ";
|
||||
break;
|
||||
case 101: std::cout << " " << whiteRook << " ";
|
||||
break;
|
||||
case 102: std::cout << " " << whiteKnight << " ";
|
||||
break;
|
||||
case 103: std::cout << " " << whiteBischop << " ";
|
||||
break;
|
||||
case 104: std::cout << " " << whiteQueen << " ";
|
||||
break;
|
||||
case 105: std::cout << " " << whiteKing << " ";
|
||||
break;
|
||||
case 100: std::cout << " " << whitePawn << " ";
|
||||
break;
|
||||
case 2: std::cout << " " << blackSquare << " ";
|
||||
break;
|
||||
case 201: std::cout << " " << blackRook << " ";
|
||||
break;
|
||||
case 202: std::cout << " " << blackKnight << " ";
|
||||
break;
|
||||
case 203: std::cout << " " << blackBischop << " ";
|
||||
break;
|
||||
case 204: std::cout << " " << blackQueen << " ";
|
||||
break;
|
||||
case 205: std::cout << " " << blackKing << " ";
|
||||
break;
|
||||
case 200: std::cout << " " << blackPawn << " ";
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
/*if ((row + col) % 2 == 0) {
|
||||
std::cout << " " << whiteSquare << " ";
|
||||
}
|
||||
else {
|
||||
std::cout << " " << blackSquare << " ";
|
||||
}
|
||||
}*/
|
||||
std::cout << vertical;
|
||||
}
|
||||
std::cout << "\n";
|
||||
@ -65,6 +121,19 @@ int main() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void givenBoard() {
|
||||
int brett[8][8] = {
|
||||
{201, 202, 203, 204, 205, 203, 202, 201},
|
||||
{200, 200, 200, 200, 200, 200, 200, 200},
|
||||
{1, 2, 1, 2, 1, 2, 1, 2},
|
||||
{2, 1, 2, 1, 2, 1, 2, 1},
|
||||
{1, 2, 1, 2, 1, 2, 1, 2},
|
||||
{2, 1, 2, 1, 2, 1, 2, 1},
|
||||
{100, 100, 100, 100, 100, 100, 100, 100},
|
||||
{101, 102, 103, 104, 105, 103, 102, 101}
|
||||
};
|
||||
}
|
||||
|
||||
/*int main() {
|
||||
//std::setlocale(LC_ALL, "");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user