diff --git a/TicTacToe/fonctions.cpp b/TicTacToe/fonctions.cpp index 989e857..a562c47 100644 --- a/TicTacToe/fonctions.cpp +++ b/TicTacToe/fonctions.cpp @@ -186,6 +186,7 @@ void afficherImageTableau(std::string grid[][LARGTIC], std::string style) { bool verifFinMatch(std::string grid[][LARGTIC], int compteur) { bool fin = false; int max = LARGTIC * LARGTIC; + string grid02 = grid[0][2]; // Pour pouvoir démarrer la diagonale 02, 11, 20 if (compteur == max) { return true; } @@ -246,13 +247,13 @@ bool verifFinMatch(std::string grid[][LARGTIC], int compteur) { // Valide diagonale 02, 11, 20 fin = true; - for (int i = 2; i > 0; i--) { + for (int i = 0; i < 3; i++) { if (grid[i][2-i] == "") { fin = false; } else { - fin = fin && (grid[i][2 - i] == grid[2-i][i]); - cout << "Vérification de " << i << "," << 2 - i << " et " << 2 - i << "," << i << endl; + fin = fin && (grid[i][2 - i] == grid02); + cout << "comparaison de " << i << "," << 2 - i << " et " << 0 << "," << 2 << endl; } }