changes table print fn

This commit is contained in:
Mylloon 2022-11-16 17:00:07 +01:00
parent 72b597b1fc
commit 434a836ecb
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -33,37 +33,30 @@ char recupere_case(Jeton *plateau[LONGEUR][LARGEUR], int case_i, int case_j) {
void affiche_plateau(Jeton *plat[LONGEUR][LARGEUR]) { void affiche_plateau(Jeton *plat[LONGEUR][LARGEUR]) {
printf(" "); printf(" ");
for (int i = 0; i < LARGEUR; ++i) { for (int debut = 'A', i = debut; i < LARGEUR + debut; ++i) {
printf(" %c ", 'A' + i); printf(" %c ", i);
} }
printf("\n"); printf("\n");
for (int i = 0; i < LONGEUR * 2 + 1; ++i) { for (int i = 0; i < LONGEUR * 2 + 1; ++i) {
for (int j = 0; j < LARGEUR; ++j) { for (int j = 0; j < LARGEUR; ++j) {
int alterne = i % 2;
if (j == 0) { if (j == 0) {
switch (i % 2) { if (alterne) {
case 0:
printf(" ");
break;
case 1:
printf("%d ", (i / 2) + 1); printf("%d ", (i / 2) + 1);
break; } else {
printf(" ");
} }
} }
if (i % 2 == 0) if (!alterne)
printf("+---"); printf("+---");
else { else {
printf("| %c ", recupere_case(plat, i / 2, j)); printf("| %c ", recupere_case(plat, i / 2, j));
} }
if (j == LARGEUR - 1) {
if (i % 2 == 0) if (j == LARGEUR - 1) {
printf("+"); printf("%c\n", alterne ? '|' : '+');
else {
printf("| ");
}
printf("\n");
} }
} }
} }