Compare commits
3 Commits
a6fd55a412
...
3ba6f53adf
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3ba6f53adf | ||
|
|
eb7e074ac4 | ||
|
|
04ba078587 |
@@ -1 +1 @@
|
|||||||
Appuyez sur une touche pour continuer...
|
Press any key to continue . . .
|
||||||
|
|||||||
@@ -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,10 @@ void afficherImageMenu(std::fstream& monFlux) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//G<>n<EFBFBD>ral (plusieurs options)
|
//G<>n<EFBFBD>ral (plusieurs options)
|
||||||
|
void initTab(string grid[][LARGTIC]) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void afficherImageTableau(std::string grid[][LARGTIC]) {
|
void afficherImageTableau(std::string grid[][LARGTIC]) {
|
||||||
SetConsoleOutputCP(CP_UTF8);
|
SetConsoleOutputCP(CP_UTF8);
|
||||||
string emoteUp,
|
string emoteUp,
|
||||||
@@ -237,20 +242,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);
|
||||||
|
gagnant = 1;
|
||||||
fin = verifFinMatch(grid);
|
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);
|
||||||
cout << endl << "Termine" << endl;
|
afficherFinMatch(grid, gagnant, nbJoueurs);
|
||||||
system("PAUSE");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void tourOrdi(string grid[][LARGTIC]) {
|
void tourOrdi(string grid[][LARGTIC]) {
|
||||||
@@ -269,16 +293,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);
|
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);
|
||||||
cout << endl << "Termine" << endl;
|
}
|
||||||
system("PAUSE");
|
|
||||||
|
//Historique
|
||||||
|
void historiqueDesScores() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//Changer le th<74>me
|
||||||
|
void changerLeTheme() {
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -21,9 +21,11 @@ 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]);
|
||||||
@@ -31,3 +33,9 @@ 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();
|
||||||
@@ -20,6 +20,7 @@ int main() {
|
|||||||
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':
|
||||||
|
|||||||
Reference in New Issue
Block a user