From ad2ae96bb1a1b6eac9b32af00582f27c8a808be8 Mon Sep 17 00:00:00 2001 From: Sunny Date: Wed, 26 Nov 2025 19:48:27 -0500 Subject: [PATCH 1/6] Je sais pas --- TicTacToe/0 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TicTacToe/0 b/TicTacToe/0 index d7619da..6fe9972 100644 --- a/TicTacToe/0 +++ b/TicTacToe/0 @@ -1 +1 @@ -Appuyez sur une touche pour continuer... \ No newline at end of file +Press any key to continue . . . From 8d6f6736531330e7d11880f2e765568a55b6c14d Mon Sep 17 00:00:00 2001 From: Sunny Date: Wed, 26 Nov 2025 19:54:33 -0500 Subject: [PATCH 2/6] =?UTF-8?q?Eum=20scuse,=20si=20quelque=20chose=20chie,?= =?UTF-8?q?=20c'est=20ma=20faute=20sur=20celle-l=C3=A0=20.=5F.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TicTacToe/fonctions.cpp | 52 ++++++++++++++++++++++---------- TicTacToe/fonctions.h | 3 +- TicTacToe/themes/themeDefaut.txt | 1 + 3 files changed, 39 insertions(+), 17 deletions(-) diff --git a/TicTacToe/fonctions.cpp b/TicTacToe/fonctions.cpp index 883abcd..75b92e7 100644 --- a/TicTacToe/fonctions.cpp +++ b/TicTacToe/fonctions.cpp @@ -49,7 +49,7 @@ void afficherMenu(char& choix) { fermerFichier(monFlux); // Menu - cout << endl << "MENU" << endl + cout << endl << "MENU" << endl << "----------------------------------" << endl << "A) 1 joueur" << endl << "B) 2 joueurs" << endl @@ -90,15 +90,15 @@ void afficherImageTableau(std::string grid[][LARGTIC], std::string style) { SetConsoleOutputCP(CP_UTF8); string emoteUp, emoteDown, - iconJ1, - iconJ2; + emoteJ1, + emoteJ2; // Faire une fonction pour retenir le thème sélectionné par le joueur!!!! ouvrirFichier(monFlux, style); if (monFlux) { while (!monFlux.eof()) { - monFlux >> emoteUp >> emoteDown >> iconJ1 >> iconJ2; + monFlux >> emoteUp >> emoteDown >> emoteJ1 >> emoteJ2; } monFlux.close(); cout << endl; @@ -110,6 +110,8 @@ void afficherImageTableau(std::string grid[][LARGTIC], std::string style) { fermerFichier(monFlux); // Lignes de code pour faire afficher le Tic Tac Toe une fois que les symboles ont été ajoutés + cout << "Joueur 1: " << emoteJ1 << " Joueur 2: " << emoteJ2 << endl << endl; + cout << " "; for (int i = 0; i < LARGTIC; i++) { cout << " " << i + 1 << " "; @@ -125,27 +127,38 @@ void afficherImageTableau(std::string grid[][LARGTIC], std::string style) { cout << endl << " "; for (int i = 0; i < LARGTIC; i++) { - cout << " |"; + cout << "|"; for (int j = 0; j < 3; j++) { cout << " "; } + cout << " "; } - cout << " |" << endl << " " << k + 1 << " "; + cout << "|" << endl << " " << k + 1 << " "; for (int i = 0; i < LARGTIC; i++) { - cout << " |" << " " << grid[k][i] << " "; - + cout << "|" << " " ; + if (grid[k][i] == "X") { + cout << emoteJ1; + } + else if (grid[k][i] == "O") { + cout << emoteJ2; + } + else { + cout << " "; + } + cout << " "; } - cout << " |" << endl << " "; + cout << "|" << endl << " "; for (int i = 0; i < LARGTIC; i++) { - cout << " |"; + cout << "|"; for (int j = 0; j < 3; j++) { cout << " "; } + cout << " "; } - cout << " |" << endl << " "; + cout << "|" << endl << " "; } @@ -187,18 +200,22 @@ void tourJoueur(string grid[][LARGTIC], int joueur) { horizontale -= 1; while (grid[verticale][horizontale] == ICONJ1 || grid[verticale][horizontale] == ICONJ2) { + // VÉRIFIER LE CIN D'ERREUR!!!!! cout << "\n\nVeuillez choisir une case vide.\n" << "\n\nEntrez une coordonnee verticale : "; cin >> verticale; cout << "\nEntrez une coordonnee horizontale : "; cin >> horizontale; + + verticale--; + horizontale--; } if (joueur == 1) { - grid[verticale - 1][horizontale - 1] = ICONJ1; + grid[verticale][horizontale] = ICONJ1; } else { - grid[verticale - 1][horizontale - 1] = ICONJ2; + grid[verticale][horizontale] = ICONJ2; } } @@ -312,7 +329,7 @@ void tourOrdi(string grid[][LARGTIC]) { do { vertical = rand() % (3); horizontal = rand() % (3); - } while (grid[vertical][horizontal] != " "); + } while (grid[vertical][horizontal] != ""); grid[vertical][horizontal] = ICONJ2; afficherImageTableau(grid, style); } @@ -339,8 +356,8 @@ void jeuDeuxJoueurs(string grid[][LARGTIC]) { } //Changer le thème -void changerLeTheme() { - string grid[LARGTIC][LARGTIC] = {ICONJ1, ICONJ2}; +void changerLeTheme(bool &theme) { + string grid[LARGTIC][LARGTIC]; system("cls"); do { cout << endl << "Changer le theme du jeu Tic Tac Toe" << endl @@ -351,6 +368,9 @@ void changerLeTheme() { choix = toupper(_getche()); cout << endl; + if (choix >= 'A' && choix <= 'D') { + theme = true; + } switch (choix) { case 'A': style = "themes/themeSea.txt"; diff --git a/TicTacToe/fonctions.h b/TicTacToe/fonctions.h index 1b58e2c..5889249 100644 --- a/TicTacToe/fonctions.h +++ b/TicTacToe/fonctions.h @@ -35,4 +35,5 @@ void tourOrdi(std::string grid[][LARGTIC]); void jeuDeuxJoueurs(std::string grid[][LARGTIC]); //Changer le thème -void changerLeTheme(); \ No newline at end of file +void changerLeTheme(bool& theme); + diff --git a/TicTacToe/themes/themeDefaut.txt b/TicTacToe/themes/themeDefaut.txt index 44305f9..2c67882 100644 --- a/TicTacToe/themes/themeDefaut.txt +++ b/TicTacToe/themes/themeDefaut.txt @@ -2,3 +2,4 @@ 🔹 âœ–ï¸ â­• + \ No newline at end of file From fcd05842edbdcc56e4ce0b700162ecc0ee2fc374 Mon Sep 17 00:00:00 2001 From: Sunny Date: Wed, 26 Nov 2025 20:02:38 -0500 Subject: [PATCH 3/6] What --- TicTacToe/fonctions.cpp | 36 ++++++++++-------------------------- 1 file changed, 10 insertions(+), 26 deletions(-) diff --git a/TicTacToe/fonctions.cpp b/TicTacToe/fonctions.cpp index 75b92e7..880205f 100644 --- a/TicTacToe/fonctions.cpp +++ b/TicTacToe/fonctions.cpp @@ -90,15 +90,15 @@ void afficherImageTableau(std::string grid[][LARGTIC], std::string style) { SetConsoleOutputCP(CP_UTF8); string emoteUp, emoteDown, - emoteJ1, - emoteJ2; + iconJ1, + iconJ2; // Faire une fonction pour retenir le thème sélectionné par le joueur!!!! ouvrirFichier(monFlux, style); if (monFlux) { while (!monFlux.eof()) { - monFlux >> emoteUp >> emoteDown >> emoteJ1 >> emoteJ2; + monFlux >> emoteUp >> emoteDown >> ICONJ1 >> ICONJ2; } monFlux.close(); cout << endl; @@ -109,9 +109,10 @@ void afficherImageTableau(std::string grid[][LARGTIC], std::string style) { } fermerFichier(monFlux); + grid[0][0] = ICONJ1; + grid[0][1] = ICONJ2; + // Lignes de code pour faire afficher le Tic Tac Toe une fois que les symboles ont été ajoutés - cout << "Joueur 1: " << emoteJ1 << " Joueur 2: " << emoteJ2 << endl << endl; - cout << " "; for (int i = 0; i < LARGTIC; i++) { cout << " " << i + 1 << " "; @@ -131,32 +132,21 @@ void afficherImageTableau(std::string grid[][LARGTIC], std::string style) { for (int j = 0; j < 3; j++) { cout << " "; } - cout << " "; } cout << "|" << endl << " " << k + 1 << " "; for (int i = 0; i < LARGTIC; i++) { - cout << "|" << " " ; - if (grid[k][i] == "X") { - cout << emoteJ1; - } - else if (grid[k][i] == "O") { - cout << emoteJ2; - } - else { - cout << " "; - } - cout << " "; + cout << "|" << " " << grid[k][i] << " "; + } - cout << "|" << endl << " "; + cout << " |" << endl << " "; for (int i = 0; i < LARGTIC; i++) { cout << "|"; for (int j = 0; j < 3; j++) { cout << " "; } - cout << " "; } cout << "|" << endl << " "; @@ -206,9 +196,6 @@ void tourJoueur(string grid[][LARGTIC], int joueur) { cin >> verticale; cout << "\nEntrez une coordonnee horizontale : "; cin >> horizontale; - - verticale--; - horizontale--; } if (joueur == 1) { @@ -356,7 +343,7 @@ void jeuDeuxJoueurs(string grid[][LARGTIC]) { } //Changer le thème -void changerLeTheme(bool &theme) { +void changerLeTheme() { string grid[LARGTIC][LARGTIC]; system("cls"); do { @@ -368,9 +355,6 @@ void changerLeTheme(bool &theme) { choix = toupper(_getche()); cout << endl; - if (choix >= 'A' && choix <= 'D') { - theme = true; - } switch (choix) { case 'A': style = "themes/themeSea.txt"; From 1f71c6d5bba217f697ad38fd3326327d44f74e18 Mon Sep 17 00:00:00 2001 From: Sunny Date: Wed, 26 Nov 2025 20:03:44 -0500 Subject: [PATCH 4/6] =?UTF-8?q?Ok=20so=20tout=20bug=20de=20mon=20bort=20so?= =?UTF-8?q?=20je=20vais=20juste=20attendre=20=C3=A0=20vendredi=20.=5F.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TicTacToe/fonctions.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TicTacToe/fonctions.h b/TicTacToe/fonctions.h index 5889249..4f45821 100644 --- a/TicTacToe/fonctions.h +++ b/TicTacToe/fonctions.h @@ -35,5 +35,5 @@ void tourOrdi(std::string grid[][LARGTIC]); void jeuDeuxJoueurs(std::string grid[][LARGTIC]); //Changer le thème -void changerLeTheme(bool& theme); +void changerLeTheme(); From 614c11ec2383e31ca43133d4c376a2359e6c4151 Mon Sep 17 00:00:00 2001 From: Lea Date: Fri, 28 Nov 2025 08:29:05 -0500 Subject: [PATCH 5/6] =?UTF-8?q?modification=20de=20la=20commande=20V=C3=A9?= =?UTF-8?q?rifFinMatch=20pour=20qu'elle=20fonctionne?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TicTacToe/fonctions.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/TicTacToe/fonctions.cpp b/TicTacToe/fonctions.cpp index eefaf4a..a87f427 100644 --- a/TicTacToe/fonctions.cpp +++ b/TicTacToe/fonctions.cpp @@ -220,13 +220,13 @@ void tourJoueur(string grid[][LARGTIC], int joueur) { } bool verifFinMatch(std::string grid[][LARGTIC]) { - bool fin = false; + bool fin = true; // Valide horizontales for (int i = 0; i < 2; i++) { fin = true; for (int j = 0; j < 2; j++) { - if (grid[i][j] == " ") { + if (grid[i][j] == "") { fin = false; } @@ -242,7 +242,7 @@ bool verifFinMatch(std::string grid[][LARGTIC]) { for (int i = 0; i < 2; i++) { fin = true; for (int j = 0; j < 2; j++) { - if (grid[i][j] == " ") { + if (grid[i][j] == "") { fin = false; } else { @@ -256,7 +256,7 @@ bool verifFinMatch(std::string grid[][LARGTIC]) { // Valide diagonale de 00, 11, 22 fin = true; for (int i = 0; i < 2; i++) { - if (grid[i][i] == " ") { + if (grid[i][i] == "") { fin = false; } else { @@ -270,7 +270,7 @@ bool verifFinMatch(std::string grid[][LARGTIC]) { // Valide diagonale 02, 11, 20 fin = true; for (int i = 2; i > 0; i--) { - if (grid[i][i] == " ") { + if (grid[i][i] == "") { fin = false; } else { From b627bfe215ee6f6f5a5e451e44784740dd2188a8 Mon Sep 17 00:00:00 2001 From: Lea Date: Fri, 28 Nov 2025 08:31:33 -0500 Subject: [PATCH 6/6] =?UTF-8?q?Revert=20"modification=20de=20la=20commande?= =?UTF-8?q?=20V=C3=A9rifFinMatch=20pour=20qu'elle=20fonctionne"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 614c11ec2383e31ca43133d4c376a2359e6c4151. --- TicTacToe/fonctions.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/TicTacToe/fonctions.cpp b/TicTacToe/fonctions.cpp index a39d7b8..880205f 100644 --- a/TicTacToe/fonctions.cpp +++ b/TicTacToe/fonctions.cpp @@ -207,13 +207,13 @@ void tourJoueur(string grid[][LARGTIC], int joueur) { } bool verifFinMatch(std::string grid[][LARGTIC]) { - bool fin = true; + bool fin = false; // Valide horizontales for (int i = 0; i < 2; i++) { fin = true; for (int j = 0; j < 2; j++) { - if (grid[i][j] == "") { + if (grid[i][j] == " ") { fin = false; } @@ -229,7 +229,7 @@ bool verifFinMatch(std::string grid[][LARGTIC]) { for (int i = 0; i < 2; i++) { fin = true; for (int j = 0; j < 2; j++) { - if (grid[i][j] == "") { + if (grid[i][j] == " ") { fin = false; } else { @@ -243,7 +243,7 @@ bool verifFinMatch(std::string grid[][LARGTIC]) { // Valide diagonale de 00, 11, 22 fin = true; for (int i = 0; i < 2; i++) { - if (grid[i][i] == "") { + if (grid[i][i] == " ") { fin = false; } else { @@ -257,7 +257,7 @@ bool verifFinMatch(std::string grid[][LARGTIC]) { // Valide diagonale 02, 11, 20 fin = true; for (int i = 2; i > 0; i--) { - if (grid[i][i] == "") { + if (grid[i][i] == " ") { fin = false; } else {