UPDATE MAJEUR : Intégration des mots de 4 lettres.

This commit is contained in:
2025-12-05 19:10:00 -05:00
parent 673920523a
commit 7b6611065c
7 changed files with 145 additions and 19 deletions

2
0
View File

@@ -1 +1 @@
Appuyez sur une touche pour continuer... Appuyez sur une touche pour continuer...

74
Mots/mot4lettres.txt Normal file
View File

@@ -0,0 +1,74 @@
abdo
abri
adon
afin
agir
aide
aigu
aile
aire
aise
allo
alma
alpe
alte
alto
amer
anal
ange
anti
anus
aria
arme
aube
auge
aura
auto
aval
avec
axer
azur
bave
bide
bien
bise
bite
bleu
blog
bobo
boom
boss
bouc
boue
boxe
bras
bref
bric
brin
brou
brun
buse
caca
cage
camp
case
cave
ceci
cent
cerf
chat
chef
cher
chez
chic
ciel
clou
club
cote
coup
cour
cout
crac
cran
cric
cube

View File

@@ -162,6 +162,7 @@
<Text Include="Alphabet\Y.txt" /> <Text Include="Alphabet\Y.txt" />
<Text Include="Alphabet\Z.txt" /> <Text Include="Alphabet\Z.txt" />
<Text Include="Mots\mot3lettres.txt" /> <Text Include="Mots\mot3lettres.txt" />
<Text Include="Mots\mot4lettres.txt" />
<Text Include="TaxonLogo.txt" /> <Text Include="TaxonLogo.txt" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@@ -19,6 +19,9 @@
<Filter Include="Fichiers de ressources\Alphabet"> <Filter Include="Fichiers de ressources\Alphabet">
<UniqueIdentifier>{df2ed3d4-f003-4ddf-afbb-9da73c17e1f3}</UniqueIdentifier> <UniqueIdentifier>{df2ed3d4-f003-4ddf-afbb-9da73c17e1f3}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="Fichiers de ressources\Mots">
<UniqueIdentifier>{e4854bf8-7fba-4be2-912e-80d765ca577e}</UniqueIdentifier>
</Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="main.cpp"> <ClCompile Include="main.cpp">
@@ -52,9 +55,6 @@
<Text Include="TaxonLogo.txt"> <Text Include="TaxonLogo.txt">
<Filter>Fichiers de ressources\AfficheMenu</Filter> <Filter>Fichiers de ressources\AfficheMenu</Filter>
</Text> </Text>
<Text Include="Mots\mot3lettres.txt">
<Filter>Fichiers de ressources</Filter>
</Text>
<Text Include="Alphabet\A.txt"> <Text Include="Alphabet\A.txt">
<Filter>Fichiers de ressources\Alphabet</Filter> <Filter>Fichiers de ressources\Alphabet</Filter>
</Text> </Text>
@@ -133,6 +133,12 @@
<Text Include="Alphabet\Z.txt"> <Text Include="Alphabet\Z.txt">
<Filter>Fichiers de ressources\Alphabet</Filter> <Filter>Fichiers de ressources\Alphabet</Filter>
</Text> </Text>
<Text Include="Mots\mot3lettres.txt">
<Filter>Fichiers de ressources\Mots</Filter>
</Text>
<Text Include="Mots\mot4lettres.txt">
<Filter>Fichiers de ressources\Mots</Filter>
</Text>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="README.md"> <None Include="README.md">

View File

@@ -24,9 +24,10 @@ int main() {
bool quitter = false; //Quitter le jeu bool quitter = false; //Quitter le jeu
int nbMot3lettre = 15; //Nombre de mot pr<70>sent dans le fichier int nbMot3lettre = 15; //Nombre de mot pr<70>sent dans le fichier
int nbLettre = 3; int nbLettre = 4;
string motRandom; // Mot random string motRandom; // Mot random
const int NOMBREMOT3LETTRE = 101; const int NOMBREMOT3LETTRE = 101;
const int NOMBREMOT4LETTRE = 74;
int nbEssai = 6; int nbEssai = 6;
while (quitter == false) { while (quitter == false) {
@@ -52,6 +53,7 @@ int main() {
curseur(true); curseur(true);
system("cls"); system("cls");
choixNbEssai(); choixNbEssai();
choixLongeurMot();
break; break;
case '3': case '3':

View File

@@ -25,7 +25,9 @@ using namespace std::chrono_literals;
const int BONNE_PLACE = 1, MAUVAIS_PLACE = 2, PAS_LA = 3; const int BONNE_PLACE = 1, MAUVAIS_PLACE = 2, PAS_LA = 3;
extern const int NOMBREMOT3LETTRE = 101; extern const int NOMBREMOT3LETTRE = 101;
extern const int NOMBREMOT4LETTRE = 74;
extern int nbEssai = 6; extern int nbEssai = 6;
extern int nbLettre = 4;
/*==================================== /*====================================
MENU MENU
@@ -110,8 +112,13 @@ string goToLine(fstream& monFlux, int numeroLigne) {//g
void effectuerTour(int nbLettre) void effectuerTour(int nbLettre)
{ {
string motRandom;
string motRandom = choisirMot("Mots/mot3lettres.txt", NOMBREMOT3LETTRE); if (nbLettre == 3) {
motRandom = choisirMot("Mots/mot3lettres.txt", NOMBREMOT3LETTRE);
}
else if (nbLettre == 4) {
motRandom = choisirMot("Mots/mot4lettres.txt", NOMBREMOT4LETTRE);
}
cout << setw(83) << "=============================================\n"; cout << setw(83) << "=============================================\n";
@@ -157,18 +164,30 @@ void effectuerTour(int nbLettre)
bool dansListe(string motPlayer) { bool dansListe(string motPlayer) {
fstream monFlux; fstream monFlux;
ouvrirFichier(monFlux, "Mots/mot3lettres.txt");
string mot; string mot;
for (int i = 0; i < NOMBREMOT3LETTRE; i++) { if (nbLettre == 3) {
getline(monFlux, mot); ouvrirFichier(monFlux, "Mots/mot3lettres.txt");
for (int i = 0; i < NOMBREMOT3LETTRE; i++) {
getline(monFlux, mot);
if (motPlayer == mot) if (motPlayer == mot)
{ {
fermerFichier(monFlux); fermerFichier(monFlux);
return true; return true;
}
}
}
else if (nbLettre == 4) {
ouvrirFichier(monFlux, "Mots/mot4lettres.txt");
for (int i = 0; i < NOMBREMOT4LETTRE; i++) {
getline(monFlux, mot);
if (motPlayer == mot)
{
fermerFichier(monFlux);
return true;
}
} }
} }
fermerFichier(monFlux); fermerFichier(monFlux);
@@ -254,11 +273,34 @@ void printLettre(fstream& monFlux, int positionLettre)
/*==================================== /*====================================
2 - OPTIONS 2 - OPTIONS
====================================*/ ====================================*/
void choixNbEssai() { void choixNbEssai()
{
cout << "Veuillez choisir le nombre de tentative que vous souhaitez avoir." cout << "Veuillez choisir le nombre de tentative que vous souhaitez avoir."
<< "\nPar defaut, le nombre de tentative est a 6." << "\nPar defaut, le nombre de tentative est a 6."
<< endl << endl
<< "Nombre de tentative : "; << "Nombre de tentative : ";
cin >> nbEssai; cin >> nbEssai;
cout << "Vous avez choisi d'avoir " << nbEssai << " tentatives."; cout << "Vous avez choisi d'avoir " << nbEssai << " tentatives."
<< endl
<< endl;
}
void choixLongeurMot() {
cout << "Veuillez choisir la longueur des mots a deviner."
<< "\nPar defaut, la longeur est a 3 lettres."
<< "\n***Pour le moment, uniquement les mots de 3 et de 4 lettres fonctionnent.***"
<< endl
<< "Longeur des mots : ";
cin >> nbLettre;
if (nbLettre == 3 || nbLettre == 4) {
cout << "Vous avez choisi d'avoir " << nbLettre << " lettres dans les mots a trouver."
<< endl
<< endl;
}
else {
nbLettre = 3;
cout << "Choix non disponible, nous avons choisis pour vous. Les mots auront 3 lettres."
<< endl
<< endl;
}
} }

View File

@@ -39,4 +39,5 @@ void printLettre(fstream& monFlux, int positionLettre);
/*==================================== /*====================================
2 - OPTIONS 2 - OPTIONS
====================================*/ ====================================*/
void choixNbEssai(); void choixNbEssai();
void choixLongeurMot();