Compare commits

...

70 Commits

Author SHA1 Message Date
Sunny
b488389d8a TOUT MARRRRRCHE!!! 2025-12-05 10:45:49 -05:00
Lea
c928b9483d modification de la fonction partie nulle 2025-12-05 10:22:44 -05:00
Sunny
ffe4af9f93 Merge branch 'main' of https://gitea.zkd.ca/DEV_WEB/TicTacToe 2025-12-05 10:13:11 -05:00
Sunny
1d513239d2 WTF 2025-12-05 10:12:30 -05:00
Lea
d445cda491 wijhfkjdfns 2025-12-05 10:09:50 -05:00
Sunny
b991978b6d Idk, dude 2025-12-05 10:02:20 -05:00
Sunny
a72da69ea7 Work 2025-12-05 09:51:51 -05:00
Lea
008f2a3329 l'affichage de partie nulle fonctionne, mais le vainqueur est affiché comme étant joueur 9 2025-12-05 09:51:40 -05:00
Sunny
00217eb38a Merge branch 'main' of https://gitea.zkd.ca/DEV_WEB/TicTacToe 2025-12-05 09:38:34 -05:00
Sunny
548c4ed27e confusion 2025-12-05 09:38:29 -05:00
Lea
1a8a5dd8d7 Merge branch 'main' of https://gitea.zkd.ca/Dev_Web/TicTacToe 2025-12-05 09:26:59 -05:00
Lea
82cbc90c4c correction de la vérif fin match, tout fonctionne mtn pour cette fonction 2025-12-05 09:26:53 -05:00
Sunny
a10845eff2 La vérif verticale marche toujours pas et jsp comment faire la partie nulle ;-; 2025-12-05 08:40:19 -05:00
Lea
763aba1a13 modification de la vérification de la fin de match avec un compteur 2025-12-05 08:30:54 -05:00
Lea
1d28babc6e Modification des 3 pour la variable constante LARGTIC 2025-11-28 10:55:42 -05:00
Lea
d6ead0a3e1 Merge branch 'main' of https://gitea.zkd.ca/Dev_Web/TicTacToe 2025-11-28 10:20:22 -05:00
Lea
d4d337a648 Ajout des trucs à terminer 2025-11-28 10:20:16 -05:00
Sunny
7c539b8612 Hi x2 2025-11-28 10:18:10 -05:00
Sunny
5ed7712c24 Hi 2025-11-28 10:17:41 -05:00
Sunny
74ec166daf Merge branch 'main' of https://gitea.zkd.ca/DEV_WEB/TicTacToe 2025-11-28 10:02:50 -05:00
lea
4740f1e484 Merge pull request 'Lea' (#1) from Lea into main
Reviewed-on: #1
2025-11-28 10:00:46 -05:00
Lea
d8889c6f4f modifications sur plusieurs niveaux 2025-11-28 09:58:25 -05:00
Lea
3ac1c10f8a création d'une branche secondaire (je pense que ç'a marché) 2025-11-28 09:42:12 -05:00
Sunny
1124360a0f Merge branch 'main' of https://gitea.zkd.ca/DEV_WEB/TicTacToe 2025-11-28 09:29:02 -05:00
Lea
0d64de9007 modification des system("PAUSE>0"), 0 changé pour nul 2025-11-28 09:22:10 -05:00
Sunny
76fda40b38 Merge branch 'main' of https://gitea.zkd.ca/DEV_WEB/TicTacToe 2025-11-28 09:20:34 -05:00
Lea
0bfac9b55e fin de mise en page pour choix du thème 2025-11-28 09:20:21 -05:00
Sunny
b94a724c06 Merge branch 'main' of https://gitea.zkd.ca/DEV_WEB/TicTacToe 2025-11-28 09:18:25 -05:00
Sunny
fa685095fc IDK 2025-11-28 09:18:21 -05:00
Lea
0e1a8f0ab2 mise en forme plus ample du choix de thème 2025-11-28 09:10:03 -05:00
Lea
14b6bcdcb6 ajout de initgrid dans le main 2025-11-28 08:56:28 -05:00
Lea
c9fea5f30d Merge branch 'main' of https://gitea.zkd.ca/Dev_Web/TicTacToe 2025-11-28 08:55:00 -05:00
Sunny
8fa7df8845 fonction initGrid(grid) mais ça marche soso 2025-11-28 08:54:55 -05:00
Lea
2729753e21 validation pour le choix du thème et ajout d'un thème par défaut 2025-11-28 08:54:52 -05:00
Sunny
f7ae8f438c Should be the same, but meh 2025-11-28 08:47:43 -05:00
Lea
370b31ce46 modification des modifications de résolution de problèmes 2025-11-28 08:42:36 -05:00
Lea
b7dae93147 résolution de problèmes de synchro 2025-11-28 08:40:28 -05:00
Lea
f60ebf6b42 Revert vers une phase qui fonctionne théoriquement 2025-11-28 08:39:24 -05:00
Lea
b627bfe215 Revert "modification de la commande VérifFinMatch pour qu'elle fonctionne"
This reverts commit 614c11ec23.
2025-11-28 08:31:33 -05:00
Lea
c03375610e Merge branch 'main' of https://gitea.zkd.ca/Dev_Web/TicTacToe 2025-11-28 08:29:19 -05:00
Lea
614c11ec23 modification de la commande VérifFinMatch pour qu'elle fonctionne 2025-11-28 08:29:05 -05:00
Sunny
1f71c6d5bb Ok so tout bug de mon bort so je vais juste attendre à vendredi ._. 2025-11-26 20:03:44 -05:00
Sunny
fcd05842ed What 2025-11-26 20:02:38 -05:00
Sunny
bb6d8afaba There 2025-11-26 19:55:59 -05:00
Sunny
8d6f673653 Eum scuse, si quelque chose chie, c'est ma faute sur celle-là ._. 2025-11-26 19:54:33 -05:00
Sunny
ad2ae96bb1 Je sais pas 2025-11-26 19:48:27 -05:00
Lea
ac31baba3d Correction du choix du thème et du tableau à 3 colones 2025-11-26 16:12:19 -05:00
Lea
957e9e7221 DERNIER COMMIT DE LA JOURNÉE 2025-11-26 11:22:59 -05:00
Lea
5597f5248d DERNIER COMMIT DE LA JOURNÉE 2025-11-26 11:22:17 -05:00
Sunny
6c10a2ab05 nom C) 2025-11-26 11:19:08 -05:00
Sunny
0f58e20f0d Merge branch 'main' of https://gitea.zkd.ca/DEV_WEB/TicTacToe 2025-11-26 11:18:18 -05:00
Sunny
45707bbab1 Condition theme 2025-11-26 11:18:07 -05:00
Sunny
57ceb7a7c6 Je sais plus 2025-11-26 11:16:42 -05:00
Lea
406e5d5196 changement de conflits 2025-11-26 11:11:11 -05:00
Lea
626c601eec modification du code pour l'apparence visuelle 2025-11-26 11:10:22 -05:00
Sunny
5e8e158d6b I'm not followinf no more 2025-11-26 11:07:07 -05:00
Sunny
21e15ec5a0 I can't remember lol 2025-11-26 10:39:29 -05:00
Sunny
20206426f0 I can't remember woups 2025-11-26 10:38:16 -05:00
Lea
a650f6bc34 résolution du problème avec l'affichage des thèmes 2025-11-26 10:38:05 -05:00
Sunny
e089dc9bc0 FUCKKKK UUUUUUU 2025-11-26 10:30:21 -05:00
Sunny
f521f78932 FUCK UUUUUUU 2025-11-26 10:29:16 -05:00
Lea
05c4c8a08c Ajout de toutes les commandes de Changer le thème et correction du code 2025-11-26 10:28:45 -05:00
Sunny
b8f22030c2 Merge branch 'main' of https://gitea.zkd.ca/DEV_WEB/TicTacToe 2025-11-26 10:19:50 -05:00
Sunny
064cf4b365 Merge branch 'main' of https://gitea.zkd.ca/DEV_WEB/TicTacToe 2025-11-26 10:19:31 -05:00
Lea
10e9c22778 Ajout des thèmes 2025-11-26 10:19:29 -05:00
Sunny
1d1b08f394 Maybe smth 2025-11-26 10:19:29 -05:00
Lea
988880817d modification de la fonction Changer le theme 2025-11-26 10:04:48 -05:00
Lea
1d7b71a802 ajout des thèmes et début de la fonction changer le theme 2025-11-26 10:03:56 -05:00
Sunny
0e4b9c8781 Merge branch 'main' of https://gitea.zkd.ca/DEV_WEB/TicTacToe 2025-11-26 10:03:06 -05:00
Sunny
324ac435a8 je sais plus, tbh 2025-11-26 10:03:04 -05:00
9 changed files with 374 additions and 160 deletions

View File

@@ -15,27 +15,30 @@ BUT : Fichier de fonctions Tic Tac Toe
using namespace std; using namespace std;
extern const int LARGTIC; extern const int LARGTIC;
const string ICONJ1 = { "X" }; string iconJ1 = "X";
const string ICONJ2 = { "O" }; string iconJ2 = "O";
const string DEFAULT = { " " }; int gagnant;
string style = "themes/themeDefaut.txt";
int codeConsole = 0; int codeConsole = 0;
fstream monFlux; fstream monFlux;
HANDLE hconsole = GetStdHandle(STD_OUTPUT_HANDLE); HANDLE hconsole = GetStdHandle(STD_OUTPUT_HANDLE);
char carre = 219, choix; char carre = 219, choix;
//<2F> faire : <20>galit<69> et entrer de coordonn<6E>e
//Fichiers //Fichiers
void ouvrirFichier(std::fstream& monFlux, std::string nomFichier) { void ouvrirFichier(std::fstream & monFlux, std::string nomFichier) {
monFlux.open(nomFichier, ios::in); monFlux.open(nomFichier, ios::in);
if (!monFlux) //On v<>rifie si le flux est "faux"/non fonctionnel. if (!monFlux) //On v<>rifie si le flux est "faux"/non fonctionnel.
{ {
cout << "ERREUR: Impossible d'ouvrir le fichier!" << endl; cout << "ERREUR: Impossible d'ouvrir le fichier!" << endl;
system("PAUSE>0"); system("PAUSE>null");
exit(1); //On quitte imm<6D>diatement le programme exit(1); //On quitte imm<6D>diatement le programme
} }
} }
void fermerFichier(std::fstream& monFlux) { void fermerFichier(std::fstream & monFlux) {
monFlux.close(); monFlux.close();
} }
@@ -49,18 +52,18 @@ void afficherMenu(char& choix) {
fermerFichier(monFlux); fermerFichier(monFlux);
// Menu // Menu
cout << endl << "MENU" << endl << "----------------------------------" << endl cout << endl << "MENU" << endl
<< "----------------------------------" << endl
<< "A) 1 joueur" << endl << "A) 1 joueur" << endl
<< "B) 2 joueurs" << endl << "B) 2 joueurs" << endl
<< "C) Montrer l'historique des scores" << endl << "C) Choisir un theme" << endl
<< "D) Changer le style du jeu" << endl
<< "Q) Quitter" << endl << endl << "Q) Quitter" << endl << endl
<< "Quel est votre choix? "; << "Quel est votre choix? ";
choix = toupper(_getche()); choix = toupper(_getche());
cout << endl; cout << endl;
} }
void afficherImageMenu(std::fstream& monFlux) { void afficherImageMenu(std::fstream & monFlux) {
int repet = 0; int repet = 0;
if (monFlux) { if (monFlux) {
while (!monFlux.eof()) { while (!monFlux.eof()) {
@@ -86,23 +89,27 @@ void afficherImageMenu(std::fstream& monFlux) {
} }
//G<>n<EFBFBD>ral (plusieurs options) //G<>n<EFBFBD>ral (plusieurs options)
void initTab(string grid[][LARGTIC]) { void initGrid(string grid[][LARGTIC]) {
for (int i = 0; i < LARGTIC; i++) { for (int i = 0; i < LARGTIC; i++) {
for (int j = 0; j < LARGTIC; i++) { for (int j = 0; j < LARGTIC; j++) {
grid[i][j] = " "; grid[i][j] = "";
} }
} }
} }
void afficherImageTableau(std::string grid[][LARGTIC]) { void afficherImageTableau(std::string grid[][LARGTIC], std::string style) {
SetConsoleOutputCP(CP_UTF8); SetConsoleOutputCP(CP_UTF8); //affiche les <20>mojis
string emoteUp, string emoteUp,
emoteDown; emoteDown,
emoteJ1,
emoteJ2;
// Faire une fonction pour retenir le th<74>me s<>lectionn<6E> par le joueur!!!! // Faire une fonction pour retenir le th<74>me s<>lectionn<6E> par le joueur!!!!
ouvrirFichier(monFlux, "themes/themeGrass.txt");
ouvrirFichier(monFlux, style);
if (monFlux) { if (monFlux) {
while (!monFlux.eof()) { while (!monFlux.eof()) {
monFlux >> emoteUp >> emoteDown; monFlux >> emoteUp >> emoteDown >> emoteJ1 >> emoteJ2;
} }
monFlux.close(); monFlux.close();
cout << endl; cout << endl;
@@ -113,6 +120,9 @@ void afficherImageTableau(std::string grid[][LARGTIC]) {
} }
fermerFichier(monFlux); fermerFichier(monFlux);
// Lignes de code pour faire afficher le Tic Tac Toe une fois que les symboles ont <20>t<EFBFBD> ajout<75>s
cout << "Joueur 1: " << emoteJ1 << " Joueur 2: " << emoteJ2 << endl << endl;
// Lignes de code pour faire afficher le Tic Tac Toe une fois que les symboles ont <20>t<EFBFBD> ajout<75>s // Lignes de code pour faire afficher le Tic Tac Toe une fois que les symboles ont <20>t<EFBFBD> ajout<75>s
cout << " "; cout << " ";
for (int i = 0; i < LARGTIC; i++) { for (int i = 0; i < LARGTIC; i++) {
@@ -129,27 +139,38 @@ void afficherImageTableau(std::string grid[][LARGTIC]) {
cout << endl << " "; cout << endl << " ";
for (int i = 0; i < LARGTIC; i++) { for (int i = 0; i < LARGTIC; i++) {
cout << " |"; cout << "|";
for (int j = 0; j < 3; j++) { for (int j = 0; j < 3; j++) {
cout << " "; cout << " ";
} }
cout << " ";
} }
cout << " |" << endl << " " << k + 1 << " "; cout << "|" << endl << " " << k + 1 << " ";
for (int i = 0; i < LARGTIC; i++) { 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++) { for (int i = 0; i < LARGTIC; i++) {
cout << " |"; cout << "|";
for (int j = 0; j < 3; j++) { for (int j = 0; j < 3; j++) {
cout << " "; cout << " ";
} }
cout << " ";
} }
cout << " |" << endl << " "; cout << "|" << endl << " ";
} }
@@ -162,123 +183,195 @@ void afficherImageTableau(std::string grid[][LARGTIC]) {
SetConsoleOutputCP(codeConsole); SetConsoleOutputCP(codeConsole);
} }
bool verifFinMatch(std::string grid[][LARGTIC], int compteur) {
bool fin = false;
int max = LARGTIC * LARGTIC;
if (compteur == max) {
return true;
}
else {
// Valide horizontales 00, 01, 02 || 10, 11, 12 || 20, 21, 22
for (int i = 0; i < LARGTIC; i++) {
fin = true;
for (int j = 0; j < LARGTIC - 1; j++) {
if (grid[i][j] == "") {
fin = false;
}
else {
fin = fin && (grid[i][j] == grid[i][j + 1]);
//cout << "comparaison de " << i << "," << j << " et " << i << "," << j+1 << endl;
}
}
if (fin == true) {
return fin;
}
}
if (fin == true) {
return fin;
}
// Valide verticales 00, 10, 20 || 01, 11, 21 || 02, 12, 22
for (int i = 0; i < LARGTIC; i++) {
fin = true;
for (int j = 0; j < LARGTIC - 1; j++) {
if (grid[j][i] == "") {
fin = false;
}
else {
fin = fin && (grid[j][i] == grid[j + 1][i]);
//cout << "comparaison de" << j << "," << i << " et " << j + 1 << "," << i << endl;
}
}
if (fin == true) {
return fin;
}
}
if (fin == true) {
return fin;
}
// Valide diagonale de 00, 11, 22
fin = true;
for (int i = 0; i < 2; i++) {
if (grid[i][i] == "") {
fin = false;
}
else {
fin = fin && (grid[i][i] == grid[i + 1][i + 1]);
}
}
if (fin == true) {
return fin;
}
// Valide diagonale 02, 11, 20
fin = true;
for (int i = 2; i > 0; i--) {
if (grid[i][i] == "") {
fin = false;
}
else {
fin = fin && (grid[i][i] == grid[i - 1][i - 1]);
}
}
if (fin == true) {
return fin;
}
}
}
void afficherFinMatch(string grid[][LARGTIC], int gagnant, int nbJoueurs) {
afficherImageTableau(grid, style);
if (nbJoueurs == 1) {
if (gagnant == 1) {
cout << "\n\nLe joueur a gagne la partie!";
}
else if (gagnant == 2) {
cout << "\n\nL'ordinateur a gagne la partie!";
}
else {
cout << "\n\nPartie nulle!";
}
}
else if (nbJoueurs == 2){
if (gagnant == 1) {
cout << "\n\nJoueur 1 a gagne la partie!";
}
else if (gagnant == 2) {
cout << "\n\nJoueur 2 a gagne la partie!";
}
else {
cout << "\n\nPartie nulle!";
}
}
}
int partieNulle(string grid[][LARGTIC], int compteur) {
int max = LARGTIC * LARGTIC;
int temp = gagnant;
if (compteur == max) {
gagnant = 3;
}
else {
gagnant = temp;
}
return gagnant;
}
// Joueur
void tourJoueur(string grid[][LARGTIC], int joueur) { void tourJoueur(string grid[][LARGTIC], int joueur) {
int verticale, int verticale,
horizontale; horizontale;
cout << "\n\nTour du joueur " << joueur << endl; cout << "\n\nTour du joueur " << joueur << endl;
afficherImageTableau(grid); afficherImageTableau(grid, style);
cout << "\n\nEntrez une coordonnee verticale : "; cout << "\n\nEntrez une coordonnee verticale : ";
cin >> verticale; cin >> verticale;
while (verticale < 1 || verticale > LARGTIC) {
cout << "\n\nVeuillez entrer une donnee valide.\n"
<< "\n\nEntrez une coordonnee verticale : ";
cin >> verticale;
}
cout << "\nEntrez une coordonnee horizontale : "; cout << "\nEntrez une coordonnee horizontale : ";
cin >> horizontale; cin >> horizontale;
while (horizontale < 1 || horizontale > LARGTIC) {
cout << "\n\nVeuillez entrer une donnee valide.\n"
<< "\n\nEntrez une coordonnee horizontale : ";
cin >> horizontale;
}
verticale -= 1;
horizontale -= 1;
while (grid[verticale][horizontale] == iconJ1 || grid[verticale][horizontale] == iconJ2) {
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) { if (joueur == 1) {
grid[verticale - 1][horizontale - 1] = ICONJ1; grid[verticale][horizontale] = iconJ1;
} }
else { else {
grid[verticale - 1][horizontale - 1] = ICONJ2; grid[verticale][horizontale] = iconJ2;
}
}
bool verifFinMatch(std::string grid[][LARGTIC]) {
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] == " ") {
fin = false;
}
else {
fin = fin && (grid[i][j] == grid[i][j + 1]);
}
}
if (fin == true) {
return fin;
}
}
// Valide verticales
for (int i = 0; i < 2; i++) {
fin = true;
for (int j = 0; j < 2; j++) {
if (grid[i][j] == " ") {
fin = false;
}
else {
fin = fin && (grid[i][j] == grid[i + 1][j]);
}
}
if (fin == true) {
return fin;
}
}
// Valide diagonale de 00, 11, 22
fin = true;
for (int i = 0; i < 2; i++) {
if (grid[i][i] == " ") {
fin = false;
}
else {
fin = fin && (grid[i][i] == grid[i + 1][i + 1]);
}
}
if (fin == true) {
return fin;
}
// Valide diagonale 02, 11, 20
fin = true;
for (int i = 2; i > 0; i--) {
if (grid[i][i] == " ") {
fin = false;
}
else {
fin = fin && (grid[i][i] == grid[i - 1][i - 1]);
}
}
if (fin == true) {
return fin;
}
}
void afficherFinMatch(string grid[][LARGTIC], int gagnant, int nbJoueurs) {
if (nbJoueurs == 1) {
if (gagnant == 1) {
cout << "\n\nLe joueur a gagne la partie!";
}
else {
cout << "\n\nL'ordinateur a gagne la partie!";
}
}
else {
cout << "\n\nLe joueur " << gagnant
<< " a gagne la partie!";
} }
} }
//1 joueur //1 joueur
void jeuUnJoueur(string grid[][LARGTIC]) { void jeuUnJoueur(string grid[][LARGTIC]) {
bool fin; bool fin;
int gagnant;
int nbJoueurs = 1; int nbJoueurs = 1;
int compteur = 0;
cout << "\nUn joueur a ete choisi. Le joueur joue en premier.\n\n"; cout << "Un joueur a ete choisi. Le joueur joue en premier.";
do { do {
tourJoueur(grid, 1); tourJoueur(grid, 1);
gagnant = 1; gagnant = 1;
fin = verifFinMatch(grid); compteur++;
fin = verifFinMatch(grid, compteur);
if (fin != true) { if (fin != true) {
tourOrdi(grid); tourOrdi(grid);
gagnant = 2; gagnant = 2;
system("PAUSE>0"); system("PAUSE>nul");
fin = verifFinMatch(grid); compteur++;
fin = verifFinMatch(grid, compteur);
} }
} while (fin != true); } while (fin != true);
gagnant = partieNulle(grid, compteur);
afficherFinMatch(grid, gagnant, nbJoueurs); afficherFinMatch(grid, gagnant, nbJoueurs);
} }
@@ -288,39 +381,152 @@ void tourOrdi(string grid[][LARGTIC]) {
cout << "\n\nTour de l'ordinateur" << endl; cout << "\n\nTour de l'ordinateur" << endl;
do { do {
vertical = rand() % (3); vertical = rand() % (LARGTIC);
horizontal = rand() % (3); horizontal = rand() % (LARGTIC);
} while (grid[vertical][horizontal] != " "); } while (grid[vertical][horizontal] != "");
grid[vertical][horizontal] = ICONJ2;
afficherImageTableau(grid); grid[vertical][horizontal] = iconJ2;
afficherImageTableau(grid, style);
} }
//2 joueurs //2 joueurs
void jeuDeuxJoueurs(string grid[][LARGTIC]) { void jeuDeuxJoueurs(string grid[][LARGTIC]) {
bool fin; bool fin;
int gagnant;
int nbJoueurs = 2; int nbJoueurs = 2;
int compteur = 0;
cout << "\nDeux joueurs a ete choisi. Les tours seront l'un a la suite de l'autre.\n\n"; cout << "\nDeux joueurs a ete choisi. Les tours seront l'un a la suite de l'autre.\n\n";
do { do {
tourJoueur(grid, 1); tourJoueur(grid, 1);
gagnant = 1; gagnant = 1;
fin = verifFinMatch(grid); compteur++;
tourJoueur(grid, 2); fin = verifFinMatch(grid, compteur);
gagnant = 2; if (fin != true) {
fin = verifFinMatch(grid); tourJoueur(grid, 2);
// la condition doit <20>tre une s<>rie de 3 symboles pareil gagnant = 2;
compteur++;
fin = verifFinMatch(grid, compteur);
}
} while (fin != true); } while (fin != true);
gagnant = partieNulle(grid, compteur);
afficherFinMatch(grid, gagnant, nbJoueurs); afficherFinMatch(grid, gagnant, nbJoueurs);
} }
//Historique
void historiqueDesScores() {
}
//Changer le th<74>me //Changer le th<74>me
void changerLeTheme() { void changerLeTheme() {
string grid[LARGTIC][LARGTIC];
system("cls");
cout << endl << "Changer le theme du jeu Tic Tac Toe" << endl;
do {
cout << endl
<< "Options des styles: " << "\n\n-------------------------------------"
<< "\nA) Par defaut"
<< "\nB) Fantaisie" << "\nC) Espace"
<< "\nD) Animaux" << "\nE) Ocean" << "\nQ) Revenir en arriere"
<< "\n\nChoisir une option: ";
choix = toupper(_getche());
cout << endl;
switch (choix) {
case 'A':
style = "themes/themeDefaut.txt";
afficherImageTableau(grid, style);
cout << "\n\nVoulez vous utiliser ce theme? ";
choix = toupper(_getche());
if (choix == 'O') {
style = "themes/themeDefaut.txt";
cout << "\nTheme choisi. \n";
}
else {
style = "themes/themeDefaut.txt";
cout << "\nLe theme par defaut sera quand meme choisi. \n";
}
break;
case 'B':
style = "themes/themeFantasy.txt";
afficherImageTableau(grid, style);
cout << "\n\nVoulez vous utiliser ce theme? ";
choix = toupper(_getche());
if (choix == 'O') {
style = "themes/themeFantasy.txt";
cout << "\nTheme choisi. \n";
}
else {
style = "themes/themeDefaut.txt";
cout << "\nLe theme par defaut sera choisi.\n";
}
break;
case 'C':
style = "themes/themeEspace.txt";
afficherImageTableau(grid, style);
cout << "\n\nVoulez vous utiliser ce theme? ";
choix = toupper(_getche());
if (choix == 'O') {
style = "themes/themeEspace.txt";
cout << "\nTheme choisi. \n";
}
else {
style = "themes/themeDefaut.txt";
cout << "\nLe theme par defaut sera choisi.\n";
}
break;
case 'D':
style = "themes/themeAnimaux.txt";
afficherImageTableau(grid, style);
cout << "\n\nVoulez vous utiliser ce theme? ";
choix = toupper(_getche());
if (choix == 'O') {
style = "themes/themeAnimaux.txt";
cout << "\nTheme choisi. \n";
}
else {
style = "themes/themeDefaut.txt";
cout << "\nLe theme par defaut sera choisi.\n";
}
break;
case 'E':
style = "themes/themeSea.txt";
afficherImageTableau(grid, style);
cout << "\n\nVoulez vous utiliser ce theme? ";
choix = toupper(_getche());
if (choix == 'O') {
style = "themes/themeSea.txt";
cout << "\nTheme choisi. \n";
}
else {
style = "themes/themeDefaut.txt";
cout << "\nLe theme par defaut sera choisi.\n";
}
break;
case 'Q':
cout << "\n\nRetour au menu principal";
break;
default:
cout << "\n\nChoisir une option valide. \n";
break;
}
} while (choix != 'Q');
} }

View File

@@ -17,15 +17,16 @@ void ouvrirFichier(std::fstream& monFlux, std::string nomFichier);
void fermerFichier(std::fstream& monFlux); void fermerFichier(std::fstream& monFlux);
//Menu //Menu
void initGrid(std::string grid[][LARGTIC]);
void afficherMenu(char& choix); void afficherMenu(char& choix);
void afficherImageMenu(std::fstream& monFlux); void afficherImageMenu(std::fstream& monFlux);
//G<>n<EFBFBD>ral //G<>n<EFBFBD>ral
void initTab(std::string grid[][LARGTIC]); void afficherImageTableau(std::string grid[][LARGTIC], std::string style);
void afficherImageTableau(std::string grid[][LARGTIC]);
void tourJoueur(std::string grid[][LARGTIC], int joueur); //pour savoir quel icon utiliser void tourJoueur(std::string grid[][LARGTIC], int joueur); //pour savoir quel icon utiliser
bool verifFinMatch(std::string grid[][LARGTIC]); bool verifFinMatch(std::string grid[][LARGTIC], int compteur);
void afficherFinMatch(std::string grid[][LARGTIC], int gagnant, int nbJoueurs); void afficherFinMatch(std::string grid[][LARGTIC], int gagnant, int nbJoueurs);
int partieNulle(std::string grid[][LARGTIC], int compteur);
//1 joueur //1 joueur
void jeuUnJoueur(std::string grid[][LARGTIC]); void jeuUnJoueur(std::string grid[][LARGTIC]);
@@ -34,8 +35,5 @@ void tourOrdi(std::string grid[][LARGTIC]);
//2 joueurs //2 joueurs
void jeuDeuxJoueurs(std::string grid[][LARGTIC]); void jeuDeuxJoueurs(std::string grid[][LARGTIC]);
//Historique
void historiqueDesScores();
//Changer le th<74>me //Changer le th<74>me
void changerLeTheme(); void changerLeTheme();

View File

@@ -10,46 +10,39 @@ BUT : Main pour le jeu Tic Tac Toe
#include "fonctions.h" #include "fonctions.h"
using namespace std; using namespace std;
const string ICONJ1 = { "X" };
const string ICONJ2 = { "O" };
int main() { int main() {
srand(time(NULL)); srand(time(NULL));
char choix; char choix;
string grid[LARGTIC][LARGTIC] = {" ", " ", " "," ", " ", " ", " ", " ", " "}; string grid[LARGTIC][LARGTIC];
do { do {
initTab(grid); initGrid(grid);
afficherMenu(choix); afficherMenu(choix);
switch (choix) { switch (choix) {
case 'A': case 'A':
system("cls"); system("cls");
jeuUnJoueur(grid); jeuUnJoueur(grid);
break; break;
case 'B': case 'B':
system("cls"); system("cls");
jeuDeuxJoueurs(grid); jeuDeuxJoueurs(grid);
break; break;
case 'C': case 'C':
historiqueDesScores(); changerLeTheme();
break; break;
case 'D': case 'Q':
changerLeTheme(); cout << "\nAu revoir!";
break; break;
case 'Q':
cout << "\nAu revoir!";
break;
default: default:
cout << endl << "Saisissez un choix valide." << endl; cout << endl << "Saisissez un choix valide." << endl;
break; break;
} }
system("PAUSE>0"); system("PAUSE>nul");
} while (choix != 'Q'); } while (choix != 'Q');
} }

View File

@@ -0,0 +1,4 @@
🍃
🌳
🐄
🐏

View File

@@ -0,0 +1,5 @@
🔹
🔹
✖️

View File

@@ -0,0 +1,4 @@
🪐
👽
🧑‍🚀

View File

@@ -0,0 +1,4 @@
🪄
🏰
🐦‍🔥
🐉

View File

@@ -1,2 +0,0 @@
🌵
🌱

View File

@@ -1,2 +1,4 @@
🌊 🌊
🪸 🪸
🦀
🐬