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]) {
printf(" ");
for (int i = 0; i < LARGEUR; ++i) {
printf(" %c ", 'A' + i);
for (int debut = 'A', i = debut; i < LARGEUR + debut; ++i) {
printf(" %c ", i);
}
printf("\n");
for (int i = 0; i < LONGEUR * 2 + 1; ++i) {
for (int j = 0; j < LARGEUR; ++j) {
int alterne = i % 2;
if (j == 0) {
switch (i % 2) {
case 0:
printf(" ");
break;
case 1:
if (alterne) {
printf("%d ", (i / 2) + 1);
break;
} else {
printf(" ");
}
}
if (i % 2 == 0)
if (!alterne)
printf("+---");
else {
printf("| %c ", recupere_case(plat, i / 2, j));
}
if (j == LARGEUR - 1) {
if (i % 2 == 0)
printf("+");
else {
printf("| ");
}
printf("\n");
if (j == LARGEUR - 1) {
printf("%c\n", alterne ? '|' : '+');
}
}
}