@@ -15,8 +15,8 @@ BUT : Fichier de fonctions Tic Tac Toe
using namespace std ;
using namespace std ;
extern const int LARGTIC ;
extern const int LARGTIC ;
string icon J1 = " X " ;
string ICON J1 = " X " ;
string icon J2 = " O " ;
string ICON J2 = " O " ;
string style = " themes/themeSea.txt " ;
string style = " themes/themeSea.txt " ;
int codeConsole = 0 ;
int codeConsole = 0 ;
@@ -90,15 +90,15 @@ void afficherImageTableau(std::string grid[][LARGTIC], std::string style) {
SetConsoleOutputCP ( CP_UTF8 ) ;
SetConsoleOutputCP ( CP_UTF8 ) ;
string emoteUp ,
string emoteUp ,
emoteDown ,
emoteDown ,
emote J1,
icon J1,
emote J2;
icon J2;
// 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 , style ) ;
ouvrirFichier ( monFlux , style ) ;
if ( monFlux ) {
if ( monFlux ) {
while ( ! monFlux . eof ( ) ) {
while ( ! monFlux . eof ( ) ) {
monFlux > > emoteUp > > emoteDown > > emote J1 > > emote J2;
monFlux > > emoteUp > > emoteDown > > ICON J1 > > ICON J2;
}
}
monFlux . close ( ) ;
monFlux . close ( ) ;
cout < < endl ;
cout < < endl ;
@@ -109,9 +109,10 @@ void afficherImageTableau(std::string grid[][LARGTIC], std::string style) {
}
}
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
grid [ 0 ] [ 0 ] = ICONJ1 ;
cout < < " Joueur 1: " < < emoteJ1 < < " Joueur 2: " < < emoteJ2 < < endl < < endl ;
grid [ 0 ] [ 1 ] = ICONJ2 ;
// 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 + + ) {
cout < < " " < < i + 1 < < " " ;
cout < < " " < < i + 1 < < " " ;
@@ -131,32 +132,21 @@ void afficherImageTableau(std::string grid[][LARGTIC], std::string style) {
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 < < " | " < < " " ;
cout < < " | " < < " " < < grid [ k ] [ i ] < < " " ;
if ( grid [ k ] [ i ] = = " X " ) {
cout < < emoteJ1 ;
}
}
else if ( grid [ k ] [ i ] = = " O " ) {
cout < < " | " < < endl < < " " ;
cout < < emoteJ2 ;
}
else {
cout < < " " ;
}
cout < < " " ;
}
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 < < " " ;
@@ -199,23 +189,20 @@ void tourJoueur(string grid[][LARGTIC], int joueur) {
verticale - = 1 ;
verticale - = 1 ;
horizontale - = 1 ;
horizontale - = 1 ;
while ( grid [ verticale ] [ horizontale ] = = icon J1 | | grid [ verticale ] [ horizontale ] = = icon J2) {
while ( grid [ verticale ] [ horizontale ] = = ICON J1 | | grid [ verticale ] [ horizontale ] = = ICON J2) {
// V<> RIFIER LE CIN D'ERREUR!!!!!
// V<> RIFIER LE CIN D'ERREUR!!!!!
cout < < " \n \n Veuillez choisir une case vide. \n "
cout < < " \n \n Veuillez choisir une case vide. \n "
< < " \n \n Entrez une coordonnee verticale : " ;
< < " \n \n Entrez une coordonnee verticale : " ;
cin > > verticale ;
cin > > verticale ;
cout < < " \n Entrez une coordonnee horizontale : " ;
cout < < " \n Entrez une coordonnee horizontale : " ;
cin > > horizontale ;
cin > > horizontale ;
verticale - - ;
horizontale - - ;
}
}
if ( joueur = = 1 ) {
if ( joueur = = 1 ) {
grid [ verticale ] [ horizontale ] = icon J1;
grid [ verticale ] [ horizontale ] = ICON J1;
}
}
else {
else {
grid [ verticale ] [ horizontale ] = icon J2;
grid [ verticale ] [ horizontale ] = ICON J2;
}
}
}
}
@@ -330,7 +317,7 @@ void tourOrdi(string grid[][LARGTIC]) {
vertical = rand ( ) % ( 3 ) ;
vertical = rand ( ) % ( 3 ) ;
horizontal = rand ( ) % ( 3 ) ;
horizontal = rand ( ) % ( 3 ) ;
} while ( grid [ vertical ] [ horizontal ] ! = " " ) ;
} while ( grid [ vertical ] [ horizontal ] ! = " " ) ;
grid [ vertical ] [ horizontal ] = icon J2;
grid [ vertical ] [ horizontal ] = ICON J2;
afficherImageTableau ( grid , style ) ;
afficherImageTableau ( grid , style ) ;
}
}
@@ -356,7 +343,7 @@ void jeuDeuxJoueurs(string grid[][LARGTIC]) {
}
}
//Changer le th<74> me
//Changer le th<74> me
void changerLeTheme ( bool & theme ) {
void changerLeTheme ( ) {
string grid [ LARGTIC ] [ LARGTIC ] ;
string grid [ LARGTIC ] [ LARGTIC ] ;
system ( " cls " ) ;
system ( " cls " ) ;
do {
do {
@@ -368,9 +355,6 @@ void changerLeTheme(bool &theme) {
choix = toupper ( _getche ( ) ) ;
choix = toupper ( _getche ( ) ) ;
cout < < endl ;
cout < < endl ;
if ( choix > = ' A ' & & choix < = ' D ' ) {
theme = true ;
}
switch ( choix ) {
switch ( choix ) {
case ' A ' :
case ' A ' :
style = " themes/themeSea.txt " ;
style = " themes/themeSea.txt " ;