@@ -17,7 +17,6 @@ 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 ;
@@ -88,7 +87,7 @@ void afficherImageMenu(std::fstream& monFlux) {
//G<> n<EFBFBD> ral (plusieurs options)
//G<> n<EFBFBD> ral (plusieurs options)
void initTab ( string grid [ ] [ LARGTIC ] ) {
void initTab ( 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 ] = " " ;
}
}
}
}
@@ -174,6 +173,14 @@ void tourJoueur(string grid[][LARGTIC], int joueur) {
cout < < " \n Entrez une coordonnee horizontale : " ;
cout < < " \n Entrez une coordonnee horizontale : " ;
cin > > horizontale ;
cin > > horizontale ;
while ( grid [ verticale ] [ horizontale ] = = ICONJ1 | | grid [ verticale ] [ horizontale ] = = ICONJ2 ) {
cout < < " \n \n Veuillez choisir une case vide. \n "
< < " \n \n Entrez une coordonnee verticale : " ;
cin > > verticale ;
cout < < " \n Entrez une coordonnee horizontale : " ;
cin > > horizontale ;
}
if ( joueur = = 1 ) {
if ( joueur = = 1 ) {
grid [ verticale - 1 ] [ horizontale - 1 ] = ICONJ1 ;
grid [ verticale - 1 ] [ horizontale - 1 ] = ICONJ1 ;
}
}
@@ -246,6 +253,8 @@ bool verifFinMatch(std::string grid[][LARGTIC]) {
}
}
void afficherFinMatch ( string grid [ ] [ LARGTIC ] , int gagnant , int nbJoueurs ) {
void afficherFinMatch ( string grid [ ] [ LARGTIC ] , int gagnant , int nbJoueurs ) {
afficherImageTableau ( grid ) ;
if ( nbJoueurs = = 1 ) {
if ( nbJoueurs = = 1 ) {
if ( gagnant = = 1 ) {
if ( gagnant = = 1 ) {
cout < < " \n \n Le joueur a gagne la partie! " ;
cout < < " \n \n Le joueur a gagne la partie! " ;