diff --git a/src/plateau.c b/src/plateau.c index 51d5eb3..136b744 100644 --- a/src/plateau.c +++ b/src/plateau.c @@ -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 ? '|' : '+'); } } }