WTF
This commit is contained in:
@@ -186,12 +186,10 @@ void afficherImageTableau(std::string grid[][LARGTIC], std::string style) {
|
|||||||
bool verifFinMatch(std::string grid[][LARGTIC], int compteur) {
|
bool verifFinMatch(std::string grid[][LARGTIC], int compteur) {
|
||||||
bool fin = false;
|
bool fin = false;
|
||||||
int max = LARGTIC * LARGTIC;
|
int max = LARGTIC * LARGTIC;
|
||||||
|
|
||||||
if (compteur == max) {
|
if (compteur == max) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
compteur++;
|
|
||||||
// Valide horizontales 00, 01, 02 || 10, 11, 12 || 20, 21, 22
|
// Valide horizontales 00, 01, 02 || 10, 11, 12 || 20, 21, 22
|
||||||
for (int i = 0; i < LARGTIC; i++) {
|
for (int i = 0; i < LARGTIC; i++) {
|
||||||
fin = true;
|
fin = true;
|
||||||
@@ -277,15 +275,6 @@ void afficherFinMatch(string grid[][LARGTIC], int gagnant, int nbJoueurs) {
|
|||||||
cout << "\n\nPartie nulle!";
|
cout << "\n\nPartie nulle!";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
if (gagnant == 3) {
|
|
||||||
cout << "\n\nPartie nulle!";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
cout << "\n\nLe joueur " << gagnant
|
|
||||||
<< " a gagne la partie!";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int partieNulle(string grid[][LARGTIC], int compteur) {
|
int partieNulle(string grid[][LARGTIC], int compteur) {
|
||||||
@@ -294,6 +283,10 @@ int partieNulle(string grid[][LARGTIC], int compteur) {
|
|||||||
gagnant = 3;
|
gagnant = 3;
|
||||||
return gagnant;
|
return gagnant;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
gagnant = 1;
|
||||||
|
return gagnant;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Joueur
|
// Joueur
|
||||||
@@ -348,7 +341,7 @@ void tourJoueur(string grid[][LARGTIC], int joueur) {
|
|||||||
//1 joueur
|
//1 joueur
|
||||||
void jeuUnJoueur(string grid[][LARGTIC]) {
|
void jeuUnJoueur(string grid[][LARGTIC]) {
|
||||||
bool fin;
|
bool fin;
|
||||||
int gagnant;
|
int gagnant = 1;
|
||||||
int nbJoueurs = 1;
|
int nbJoueurs = 1;
|
||||||
int compteur = 0;
|
int compteur = 0;
|
||||||
|
|
||||||
@@ -357,15 +350,17 @@ void jeuUnJoueur(string grid[][LARGTIC]) {
|
|||||||
do {
|
do {
|
||||||
tourJoueur(grid, 1);
|
tourJoueur(grid, 1);
|
||||||
gagnant = 1;
|
gagnant = 1;
|
||||||
|
compteur++;
|
||||||
fin = verifFinMatch(grid, compteur);
|
fin = verifFinMatch(grid, compteur);
|
||||||
gagnant = partieNulle(grid, compteur);
|
|
||||||
if (fin != true) {
|
if (fin != true) {
|
||||||
tourOrdi(grid);
|
tourOrdi(grid);
|
||||||
gagnant = 2;
|
gagnant = 2;
|
||||||
system("PAUSE>nul");
|
system("PAUSE>nul");
|
||||||
|
compteur++;
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -386,7 +381,7 @@ 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 gagnant = 1;
|
||||||
int nbJoueurs = 2;
|
int nbJoueurs = 2;
|
||||||
int compteur = 0;
|
int compteur = 0;
|
||||||
|
|
||||||
@@ -395,14 +390,13 @@ void jeuDeuxJoueurs(string grid[][LARGTIC]) {
|
|||||||
do {
|
do {
|
||||||
tourJoueur(grid, 1);
|
tourJoueur(grid, 1);
|
||||||
gagnant = 1;
|
gagnant = 1;
|
||||||
fin = verifFinMatch(grid, compteur);
|
|
||||||
compteur++;
|
compteur++;
|
||||||
|
fin = verifFinMatch(grid, compteur);
|
||||||
if (fin != true) {
|
if (fin != true) {
|
||||||
tourJoueur(grid, 2);
|
tourJoueur(grid, 2);
|
||||||
gagnant = 2;
|
gagnant = 2;
|
||||||
fin = verifFinMatch(grid, compteur);
|
|
||||||
compteur++;
|
compteur++;
|
||||||
|
fin = verifFinMatch(grid, compteur);
|
||||||
}
|
}
|
||||||
} while (fin != true);
|
} while (fin != true);
|
||||||
gagnant = partieNulle(grid, compteur);
|
gagnant = partieNulle(grid, compteur);
|
||||||
|
|||||||
Reference in New Issue
Block a user