fix printBoard
index
This commit is contained in:
parent
3cbb9989c6
commit
3d9ddad0b6
13
main.cpp
13
main.cpp
@ -246,10 +246,10 @@ void printBoard(char **board, int x, int y) {
|
||||
int maxLength = 0;
|
||||
for (int i = 0; i < x; ++i) {
|
||||
int length = 2 + (i >= 10 ? 2 : 1);
|
||||
for(int j = 0; j < y; ++j) {
|
||||
length = max(length, (int)ans[i + 2][j + 2].size());
|
||||
}
|
||||
maxLength = max(maxLength, length);
|
||||
for (int j = 0; j < y; ++j) {
|
||||
length = max(length, (int) ans[i + 2][j + 2].size());
|
||||
}
|
||||
maxLength = max(maxLength, length);
|
||||
}
|
||||
|
||||
// Print the first two rows with the calculated spaces
|
||||
@ -258,6 +258,9 @@ void printBoard(char **board, int x, int y) {
|
||||
pt ' ';
|
||||
}
|
||||
for (int j = 0; j < y; ++j) {
|
||||
if (!j) {
|
||||
pt ' ';
|
||||
}
|
||||
pt ans[i][j];
|
||||
}
|
||||
pt nl;
|
||||
@ -266,7 +269,7 @@ void printBoard(char **board, int x, int y) {
|
||||
// Print the rest of the board
|
||||
for (int i = 2; i < boardX; ++i) {
|
||||
for (int j = 0; j < boardY; ++j) {
|
||||
if (j==2) {
|
||||
if (j == 2) {
|
||||
pt ' ';
|
||||
}
|
||||
pt ans[i][j];
|
||||
|
Loading…
Reference in New Issue
Block a user