all of it lol

This commit is contained in:
Sunny
2025-11-26 09:06:07 -05:00
parent 1522e531b5
commit 04ba078587
4 changed files with 59 additions and 6 deletions

View File

@@ -1 +1 @@
Appuyez sur une touche pour continuer... Press any key to continue . . .

View File

@@ -17,6 +17,7 @@ using namespace std;
extern const int LARGTIC; extern const int LARGTIC;
const string ICONJ1 = { "X" }; const string ICONJ1 = { "X" };
const string ICONJ2 = { "O" }; const string ICONJ2 = { "O" };
const string DEFAULT = { " " };
int codeConsole = 0; int codeConsole = 0;
fstream monFlux; fstream monFlux;
@@ -85,6 +86,11 @@ void afficherImageMenu(std::fstream& monFlux) {
} }
//G<>n<EFBFBD>ral (plusieurs options) //G<>n<EFBFBD>ral (plusieurs options)
void initTab(string grid[][LARGTIC]) {
grid[LARGTIC][LARGTIC];
}
void afficherImageTableau(std::string grid[][LARGTIC]) { void afficherImageTableau(std::string grid[][LARGTIC]) {
SetConsoleOutputCP(CP_UTF8); SetConsoleOutputCP(CP_UTF8);
string emoteUp, string emoteUp,
@@ -215,18 +221,39 @@ bool verifFinMatch(std::string grid[][LARGTIC]) {
} }
} }
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;
cout << "\nUn joueur a ete choisi. Le joueur joue en premier.\n\n"; cout << "\nUn joueur a ete choisi. Le joueur joue en premier.\n\n";
do { do {
tourJoueur(grid, 1); tourJoueur(grid, 1);
//fin = verifFinMatch(grid); gagnant = 1;
fin = verifFinMatch(grid);
tourOrdi(grid); tourOrdi(grid);
gagnant = 2;
system("PAUSE>0"); system("PAUSE>0");
fin = verifFinMatch(grid); fin = verifFinMatch(grid);
} while (fin != true); } while (fin != true);
afficherFinMatch(grid, gagnant, nbJoueurs);
} }
void tourOrdi(string grid[][LARGTIC]) { void tourOrdi(string grid[][LARGTIC]) {
@@ -245,12 +272,29 @@ void tourOrdi(string grid[][LARGTIC]) {
//2 joueurs //2 joueurs
void jeuDeuxJoueurs(string grid[][LARGTIC]) { void jeuDeuxJoueurs(string grid[][LARGTIC]) {
bool fin; bool fin;
int gagnant;
int nbJoueurs = 2;
cout << endl << "Deux joueurs a ete choisi. Les tours seront l'un a la suite de l'autre." << endl << endl; cout << endl << "Deux joueurs a ete choisi. Les tours seront l'un a la suite de l'autre." << endl << endl;
do { do {
tourJoueur(grid, 1); tourJoueur(grid, 1);
gagnant = 1;
fin = verifFinMatch(grid);
tourJoueur(grid, 2); tourJoueur(grid, 2);
gagnant = 2;
fin = verifFinMatch(grid); fin = verifFinMatch(grid);
// la condition doit <20>tre une s<>rie de 3 symboles pareil // la condition doit <20>tre une s<>rie de 3 symboles pareil
} while (fin != true); } while (fin != true);
afficherFinMatch(grid, gagnant, nbJoueurs);
}
//Historique
void historiqueDesScores() {
}
//Changer le th<74>me
void changerLeTheme() {
} }

View File

@@ -21,13 +21,21 @@ 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]); 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]);
void afficherFinMatch(std::string grid[][LARGTIC], int gagnant, int nbJoueurs);
//1 joueur //1 joueur
void jeuUnJoueur(std::string grid[][LARGTIC]); void jeuUnJoueur(std::string grid[][LARGTIC]);
void tourOrdi(std::string grid[][LARGTIC]); 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
void changerLeTheme();

View File

@@ -17,9 +17,10 @@ int main() {
srand(time(NULL)); srand(time(NULL));
char choix; char choix;
string grid[LARGTIC][LARGTIC] = { " ", " ", " "," ", " ", " ", " ", " ", " "}; string grid[LARGTIC][LARGTIC] = { " ", " ", " "," ", " ", " ", " ", " ", " " };
do { do {
initTab(grid);
afficherMenu(choix); afficherMenu(choix);
switch (choix) { switch (choix) {
@@ -34,11 +35,11 @@ int main() {
break; break;
case 'C': case 'C':
historiqueDesScores();
break; break;
case 'D': case 'D':
changerLeTheme();
break; break;
case 'Q': case 'Q':