Compare commits

...

25 Commits

Author SHA1 Message Date
95f56b5509 JEU FONCTIONNEL !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2025-12-06 00:53:36 -05:00
f6d1303095 Ajout: Bloc de commentaire sur les test. Selon énoncé : "À la fin du développement, vous devez créer un bloc de commentaires au-dessus de la déclaration du main() pour expliquer et
indiquer les tests qui ont été effectués afin de vérifier que votre application fonctionne correctement."
2025-12-06 00:26:07 -05:00
64154b3a56 Ajout victoire et défaite 2025-12-06 00:22:49 -05:00
fa623541ff Enregistrement de mes dernieres modifications 2025-12-06 00:03:04 -05:00
24cd682bdb Implémentation total de la prise en charge en simultané des mots a 3 et 4 lettres. 2025-12-05 23:52:58 -05:00
7b6611065c UPDATE MAJEUR : Intégration des mots de 4 lettres. 2025-12-05 19:10:00 -05:00
673920523a Réorganisation du fichier mesFonctions.cpp 2025-12-05 18:08:46 -05:00
707d07fbbd Ajout docu sur les erreurs 2025-12-05 18:04:23 -05:00
eb24e9279d Simplification du système de couleur des lettres (tous est dans une fonction) 2025-12-05 17:57:26 -05:00
9dede478c0 Correctif : Menu d'option sélection du nombre de tentative. 2025-12-05 17:42:32 -05:00
dfb40af3dc Ajout à la liste des mots 2025-12-05 17:35:05 -05:00
1068695609 Changement alphabet + ajout TODO 2025-12-05 12:52:04 -05:00
150e533402 Update: liste de mots 2025-12-05 11:35:42 -05:00
02d1062f97 Ajouts de mots dans la liste 2025-12-05 11:08:26 -05:00
William
1c14c5ddb0 Merge branch 'main' of https://gitea.zkd.ca/TAXON/taxon 2025-12-05 10:22:49 -05:00
William
6027a79491 corirger lettre 2025-12-05 10:22:43 -05:00
ac8fa1e0fb Correctifs au lettres 2025-12-05 10:15:12 -05:00
William
15616971d8 changement de merde 2025-12-05 09:52:53 -05:00
b3ca976b13 Lettre graphique 2025-12-05 09:52:06 -05:00
b38c59c22d Merge branch 'main' of https://gitea.zkd.ca/TAXON/Taxon 2025-12-05 09:28:44 -05:00
438579f393 Ajout affichage graphique 2025-12-05 09:28:35 -05:00
William
72f9184b20 vérification des lettres 2025-12-05 09:27:56 -05:00
9f3028e324 Leger correctif d'un oublie 2025-11-28 10:17:30 -05:00
c7f785967e Merge branch 'main' of https://gitea.zkd.ca/TAXON/Taxon 2025-11-28 10:16:48 -05:00
b53ff47364 Alphabet en alpha testing :3 2025-11-28 10:16:42 -05:00
34 changed files with 693 additions and 105 deletions

View File

@@ -1,5 +1,7 @@
00 00 00 00 00 00 99
00 00 15 15 00 00 99 00 00 15 15 00 00 99
00 15 00 00 15 00 99 00 15 00 00 15 00 99
00 15 00 00 15 00 99 00 15 00 00 15 00 99
00 15 15 15 15 00 99 00 15 15 15 15 00 99
00 15 00 00 15 00 99 00 15 00 00 15 00 99
00 00 00 00 00 00 99

7
Alphabet/B.txt Normal file
View File

@@ -0,0 +1,7 @@
00 00 00 00 00 00 99
00 15 15 15 00 00 99
00 15 00 00 15 00 99
00 15 15 15 00 00 99
00 15 00 00 15 00 99
00 15 15 15 00 00 99
00 00 00 00 00 00 99

7
Alphabet/C.txt Normal file
View File

@@ -0,0 +1,7 @@
00 00 00 00 00 00 99
00 00 15 15 00 00 99
00 15 00 00 15 00 99
00 15 00 00 00 00 99
00 15 00 00 15 00 99
00 00 15 15 00 00 99
00 00 00 00 00 00 99

7
Alphabet/D.txt Normal file
View File

@@ -0,0 +1,7 @@
00 00 00 00 00 00 99
00 15 15 15 00 00 99
00 15 00 00 15 00 99
00 15 00 00 15 00 99
00 15 00 00 15 00 99
00 15 15 15 00 00 99
00 00 00 00 00 00 99

7
Alphabet/E.txt Normal file
View File

@@ -0,0 +1,7 @@
00 00 00 00 00 00 99
00 00 15 15 15 00 99
00 15 00 00 00 00 99
00 15 15 15 00 00 99
00 15 00 00 00 00 99
00 00 15 15 15 00 99
00 00 00 00 00 00 99

7
Alphabet/F.txt Normal file
View File

@@ -0,0 +1,7 @@
00 00 00 00 00 00 99
00 00 15 15 15 00 99
00 15 00 00 00 00 99
00 15 15 15 00 00 99
00 15 00 00 00 00 99
00 15 00 00 00 00 99
00 00 00 00 00 00 99

7
Alphabet/G.txt Normal file
View File

@@ -0,0 +1,7 @@
00 00 00 00 00 00 99
00 00 15 15 15 00 99
00 15 00 00 00 00 99
00 15 00 15 15 00 99
00 15 00 00 15 00 99
00 00 15 15 00 00 99
00 00 00 00 00 00 99

7
Alphabet/H.txt Normal file
View File

@@ -0,0 +1,7 @@
00 00 00 00 00 00 99
00 15 00 00 15 00 99
00 15 00 00 15 00 99
00 15 15 15 15 00 99
00 15 00 00 15 00 99
00 15 00 00 15 00 99
00 00 00 00 00 00 99

7
Alphabet/I.txt Normal file
View File

@@ -0,0 +1,7 @@
00 00 00 00 00 99
00 15 15 15 00 99
00 00 15 00 00 99
00 00 15 00 00 99
00 00 15 00 00 99
00 15 15 15 00 99
00 00 00 00 00 99

7
Alphabet/J.txt Normal file
View File

@@ -0,0 +1,7 @@
00 00 00 00 00 99
00 15 15 15 00 99
00 00 00 15 00 99
00 00 00 15 00 99
00 15 00 15 00 99
00 00 15 15 00 99
00 00 00 00 00 99

7
Alphabet/K.txt Normal file
View File

@@ -0,0 +1,7 @@
00 00 00 00 00 00 99
00 15 00 00 15 00 99
00 15 00 15 00 00 99
00 15 15 00 00 00 99
00 15 00 15 00 00 99
00 15 00 00 15 00 99
00 00 00 00 00 00 99

7
Alphabet/L.txt Normal file
View File

@@ -0,0 +1,7 @@
00 00 00 00 00 99
00 15 00 00 00 99
00 15 00 00 00 99
00 15 00 00 00 99
00 15 00 00 00 99
00 15 15 15 00 99
00 00 00 00 00 99

7
Alphabet/M.txt Normal file
View File

@@ -0,0 +1,7 @@
00 00 00 00 00 00 00 99
00 00 15 00 15 00 00 99
00 15 00 15 00 15 00 99
00 15 00 15 00 15 00 99
00 15 00 00 00 15 00 99
00 15 00 00 00 15 00 99
00 00 00 00 00 00 00 99

7
Alphabet/N.txt Normal file
View File

@@ -0,0 +1,7 @@
00 00 00 00 00 00 99
00 15 00 00 15 00 99
00 15 00 00 15 00 99
00 15 15 00 15 00 99
00 15 00 15 15 00 99
00 15 00 00 15 00 99
00 00 00 00 00 00 99

7
Alphabet/O.txt Normal file
View File

@@ -0,0 +1,7 @@
00 00 00 00 00 00 99
00 00 15 15 00 00 99
00 15 00 00 15 00 99
00 15 00 00 15 00 99
00 15 00 00 15 00 99
00 00 15 15 00 00 99
00 00 00 00 00 00 99

7
Alphabet/P.txt Normal file
View File

@@ -0,0 +1,7 @@
00 00 00 00 00 00 99
00 00 15 15 00 00 99
00 15 00 00 15 00 99
00 15 15 15 00 00 99
00 15 00 00 00 00 99
00 15 00 00 00 00 99
00 00 00 00 00 00 99

7
Alphabet/Q.txt Normal file
View File

@@ -0,0 +1,7 @@
00 00 00 00 00 00 00 99
00 00 15 15 00 00 00 99
00 15 00 00 15 00 00 99
00 15 00 00 15 00 00 99
00 15 00 00 15 00 00 99
00 00 15 15 00 15 00 99
00 00 00 00 00 00 00 99

7
Alphabet/R.txt Normal file
View File

@@ -0,0 +1,7 @@
00 00 00 00 00 00 99
00 00 15 15 00 00 99
00 15 00 00 15 00 99
00 15 15 15 00 00 99
00 15 00 00 15 00 99
00 15 00 00 15 00 99
00 00 00 00 00 00 99

7
Alphabet/S.txt Normal file
View File

@@ -0,0 +1,7 @@
00 00 00 00 00 00 99
00 00 15 15 15 00 99
00 15 00 00 00 00 99
00 00 15 15 00 00 99
00 00 00 00 15 00 99
00 15 15 15 00 00 99
00 00 00 00 00 00 99

7
Alphabet/T.txt Normal file
View File

@@ -0,0 +1,7 @@
00 00 00 00 00 99
00 15 15 15 00 99
00 00 15 00 00 99
00 00 15 00 00 99
00 00 15 00 00 99
00 00 15 00 00 99
00 00 00 00 00 99

7
Alphabet/U.txt Normal file
View File

@@ -0,0 +1,7 @@
00 00 00 00 00 00 99
00 15 00 00 15 00 99
00 15 00 00 15 00 99
00 15 00 00 15 00 99
00 15 00 00 15 00 99
00 00 15 15 00 00 99
00 00 00 00 00 00 99

7
Alphabet/V.txt Normal file
View File

@@ -0,0 +1,7 @@
00 00 00 00 00 00 00 99
00 15 00 00 00 15 00 99
00 15 00 00 00 15 00 99
00 15 00 00 00 15 00 99
00 00 15 00 15 00 00 99
00 00 00 15 00 00 00 99
00 00 00 00 00 00 00 99

7
Alphabet/W.txt Normal file
View File

@@ -0,0 +1,7 @@
00 00 00 00 00 00 00 99
00 15 00 00 00 15 00 99
00 15 00 15 00 15 00 99
00 15 00 15 00 15 00 99
00 15 00 15 00 15 00 99
00 00 15 15 15 00 00 99
00 00 00 00 00 00 00 99

7
Alphabet/X.txt Normal file
View File

@@ -0,0 +1,7 @@
00 00 00 00 00 99
00 15 00 15 00 99
00 15 00 15 00 99
00 00 15 00 00 99
00 15 00 15 00 99
00 15 00 15 00 99
00 00 00 00 00 99

7
Alphabet/Y.txt Normal file
View File

@@ -0,0 +1,7 @@
00 00 00 00 00 99
00 15 00 15 00 99
00 15 00 15 00 99
00 15 15 15 00 99
00 00 15 00 00 99
00 00 15 00 00 99
00 00 00 00 00 99

7
Alphabet/Z.txt Normal file
View File

@@ -0,0 +1,7 @@
00 00 00 00 00 00 99
00 15 15 15 15 00 99
00 00 00 00 15 00 99
00 00 00 15 00 00 99
00 00 15 00 00 00 99
00 15 15 15 15 00 99
00 00 00 00 00 00 99

View File

@@ -13,3 +13,89 @@ toi
moi moi
eux eux
mat mat
les
met
mer
dos
bon
oui
non
son
bas
mal
lot
des
sac
est
jeu
bus
eau
col
lit
lui
aie
ail
mou
dur
sel
elf
ble
gel
vue
nul
ion
fin
vie
tri
ris
lis
feu
peu
fou
pas
bac
air
ami
arc
but
car
cas
mai
mon
pin
pro
que
qui
six
sud
vif
vin
vis
vol
vos
dix
ane
art
aux
don
fan
gai
lac
rat
lys
bal
bel
dil
lin
jus
nid
bru
fer
cru
pur
tir
zoo
bat
toc
rap
tas

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

@@ -1,11 +1,13 @@
# Taxon # Taxon
# Add to VS 2022 ## Codes d'erreur
Install GIT for Windows : https://git-scm.com/install/windows Erreur 1
```
Cette erreur peut survenir lorsqu'un fichier n'arrive pas <20> s'ouvrir ou se fermer.
```
Erreur 2
``` ```
git config credential.helper wincred Cette erreur peut survenir lors d'un probl<62>me dans l'affichage des lettres.
git config user.email 'empty@zkd.ca'
git config user.name 'Nom du coequipier'
``` ```

View File

@@ -135,7 +135,34 @@
<Text Include="AfficheMenu\TaxonOption1.txt" /> <Text Include="AfficheMenu\TaxonOption1.txt" />
<Text Include="AfficheMenu\TaxonOption2.txt" /> <Text Include="AfficheMenu\TaxonOption2.txt" />
<Text Include="AfficheMenu\TaxonOption3.txt" /> <Text Include="AfficheMenu\TaxonOption3.txt" />
<Text Include="Alphabet\Normal\A.txt" /> <Text Include="Alphabet\A.txt" />
<Text Include="Alphabet\B.txt" />
<Text Include="Alphabet\C.txt" />
<Text Include="Alphabet\D.txt" />
<Text Include="Alphabet\E.txt" />
<Text Include="Alphabet\F.txt" />
<Text Include="Alphabet\G.txt" />
<Text Include="Alphabet\H.txt" />
<Text Include="Alphabet\I.txt" />
<Text Include="Alphabet\J.txt" />
<Text Include="Alphabet\K.txt" />
<Text Include="Alphabet\L.txt" />
<Text Include="Alphabet\M.txt" />
<Text Include="Alphabet\N.txt" />
<Text Include="Alphabet\O.txt" />
<Text Include="Alphabet\P.txt" />
<Text Include="Alphabet\Q.txt" />
<Text Include="Alphabet\R.txt" />
<Text Include="Alphabet\S.txt" />
<Text Include="Alphabet\T.txt" />
<Text Include="Alphabet\U.txt" />
<Text Include="Alphabet\V.txt" />
<Text Include="Alphabet\W.txt" />
<Text Include="Alphabet\X.txt" />
<Text Include="Alphabet\Y.txt" />
<Text Include="Alphabet\Z.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,17 +19,8 @@
<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\Alphabet\Normal"> <Filter Include="Fichiers de ressources\Mots">
<UniqueIdentifier>{8064397c-076b-4f78-81d1-972b604b522d}</UniqueIdentifier> <UniqueIdentifier>{e4854bf8-7fba-4be2-912e-80d765ca577e}</UniqueIdentifier>
</Filter>
<Filter Include="Fichiers de ressources\Alphabet\BonEmplacement">
<UniqueIdentifier>{833d80c9-3c2f-493f-a670-3578c6c38820}</UniqueIdentifier>
</Filter>
<Filter Include="Fichiers de ressources\Alphabet\MauvaisEmplacement">
<UniqueIdentifier>{219b9b47-768d-4ad2-bc5e-06f9906b7902}</UniqueIdentifier>
</Filter>
<Filter Include="Fichiers de ressources\Alphabet\Inexistant">
<UniqueIdentifier>{0e8fa072-7227-45e7-9f12-72b6afa5933f}</UniqueIdentifier>
</Filter> </Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@@ -58,15 +49,96 @@
<Text Include="AfficheMenu\TaxonOption3.txt"> <Text Include="AfficheMenu\TaxonOption3.txt">
<Filter>Fichiers de ressources\AfficheMenu</Filter> <Filter>Fichiers de ressources\AfficheMenu</Filter>
</Text> </Text>
<Text Include="Alphabet\Normal\A.txt">
<Filter>Fichiers de ressources\Alphabet\Normal</Filter>
</Text>
<Text Include="AfficheMenu\Quitter.txt"> <Text Include="AfficheMenu\Quitter.txt">
<Filter>Fichiers de ressources\AfficheMenu</Filter> <Filter>Fichiers de ressources\AfficheMenu</Filter>
</Text> </Text>
<Text Include="TaxonLogo.txt"> <Text Include="TaxonLogo.txt">
<Filter>Fichiers de ressources\AfficheMenu</Filter> <Filter>Fichiers de ressources\AfficheMenu</Filter>
</Text> </Text>
<Text Include="Alphabet\A.txt">
<Filter>Fichiers de ressources\Alphabet</Filter>
</Text>
<Text Include="Alphabet\B.txt">
<Filter>Fichiers de ressources\Alphabet</Filter>
</Text>
<Text Include="Alphabet\C.txt">
<Filter>Fichiers de ressources\Alphabet</Filter>
</Text>
<Text Include="Alphabet\D.txt">
<Filter>Fichiers de ressources\Alphabet</Filter>
</Text>
<Text Include="Alphabet\E.txt">
<Filter>Fichiers de ressources\Alphabet</Filter>
</Text>
<Text Include="Alphabet\F.txt">
<Filter>Fichiers de ressources\Alphabet</Filter>
</Text>
<Text Include="Alphabet\G.txt">
<Filter>Fichiers de ressources\Alphabet</Filter>
</Text>
<Text Include="Alphabet\H.txt">
<Filter>Fichiers de ressources\Alphabet</Filter>
</Text>
<Text Include="Alphabet\I.txt">
<Filter>Fichiers de ressources\Alphabet</Filter>
</Text>
<Text Include="Alphabet\J.txt">
<Filter>Fichiers de ressources\Alphabet</Filter>
</Text>
<Text Include="Alphabet\K.txt">
<Filter>Fichiers de ressources\Alphabet</Filter>
</Text>
<Text Include="Alphabet\L.txt">
<Filter>Fichiers de ressources\Alphabet</Filter>
</Text>
<Text Include="Alphabet\M.txt">
<Filter>Fichiers de ressources\Alphabet</Filter>
</Text>
<Text Include="Alphabet\N.txt">
<Filter>Fichiers de ressources\Alphabet</Filter>
</Text>
<Text Include="Alphabet\O.txt">
<Filter>Fichiers de ressources\Alphabet</Filter>
</Text>
<Text Include="Alphabet\P.txt">
<Filter>Fichiers de ressources\Alphabet</Filter>
</Text>
<Text Include="Alphabet\Q.txt">
<Filter>Fichiers de ressources\Alphabet</Filter>
</Text>
<Text Include="Alphabet\R.txt">
<Filter>Fichiers de ressources\Alphabet</Filter>
</Text>
<Text Include="Alphabet\S.txt">
<Filter>Fichiers de ressources\Alphabet</Filter>
</Text>
<Text Include="Alphabet\T.txt">
<Filter>Fichiers de ressources\Alphabet</Filter>
</Text>
<Text Include="Alphabet\U.txt">
<Filter>Fichiers de ressources\Alphabet</Filter>
</Text>
<Text Include="Alphabet\V.txt">
<Filter>Fichiers de ressources\Alphabet</Filter>
</Text>
<Text Include="Alphabet\W.txt">
<Filter>Fichiers de ressources\Alphabet</Filter>
</Text>
<Text Include="Alphabet\X.txt">
<Filter>Fichiers de ressources\Alphabet</Filter>
</Text>
<Text Include="Alphabet\Y.txt">
<Filter>Fichiers de ressources\Alphabet</Filter>
</Text>
<Text Include="Alphabet\Z.txt">
<Filter>Fichiers de ressources\Alphabet</Filter>
</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

@@ -6,6 +6,15 @@ DATE : 17 novembre 2025
BUT : Rassemble les appels de fonction de Taxon BUT : Rassemble les appels de fonction de Taxon
====================================*/ ====================================*/
/*
SCOREBOARD pour fichier en <20>criture
*/
//Librairies //Librairies
#include <iostream> #include <iostream>
#include <conio.h> #include <conio.h>
@@ -17,19 +26,22 @@ BUT : Rassemble les appels de fonction de Taxon
//D<>claration des namespaces //D<>claration des namespaces
using namespace std; using namespace std;
//D<>claration du main extern int nbEssai = 6;
extern int nbLettre = 4;
/*====================================
Tester que les lettres se r<>p<EFBFBD>tant fonctionnent.
====================================*/
int main() { int main() {
srand(time(NULL)); srand(time(NULL));
HANDLE hconsole = GetStdHandle(STD_OUTPUT_HANDLE); //D<>claration de variable pour les images HANDLE hconsole = GetStdHandle(STD_OUTPUT_HANDLE); //D<>claration de variable pour les images
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 temp = 0; //TODO: Variable temporaire
string motRandom; // Mot random string motRandom; // Mot random
while (quitter == false) { while (quitter == false) {
curseur(false); curseur(false);
backgroundDefault();
afficherMenu("AfficheMenu/Taxon.txt"); afficherMenu("AfficheMenu/Taxon.txt");
int choixMenu = _getch(); int choixMenu = _getch();
@@ -40,7 +52,6 @@ int main() {
delai(); delai();
curseur(true); curseur(true);
system("cls"); system("cls");
//background(temp);
effectuerTour(); effectuerTour();
break; break;
@@ -50,14 +61,13 @@ int main() {
delai(); delai();
curseur(true); curseur(true);
system("cls"); system("cls");
temp = demanderBackground(); choixNbEssai();
background(temp); choixLongeurMot();
break; break;
case '3': case '3':
afficherMenu("AfficheMenu/TaxonOption3.txt"); afficherMenu("AfficheMenu/TaxonOption3.txt");
delai(); delai();
background('1');
afficherMenu("AfficheMenu/Quitter.txt"); afficherMenu("AfficheMenu/Quitter.txt");
quitter = true; quitter = true;
break; break;

View File

@@ -23,6 +23,9 @@ using namespace std::chrono_literals;
#include <limits> //Sources : https://www.tutorialspoint.com/cpp_standard_library/limits.htm et https://stackoverflow.com/questions/2158943/split-string-into-array-of-chars #include <limits> //Sources : https://www.tutorialspoint.com/cpp_standard_library/limits.htm et https://stackoverflow.com/questions/2158943/split-string-into-array-of-chars
const int BONNE_PLACE = 1, MAUVAIS_PLACE = 2, PAS_LA = 3;
extern int nbEssai;
extern int nbLettre;
/*==================================== /*====================================
MENU MENU
@@ -39,6 +42,7 @@ void ouvrirFichier(fstream& monFlux, string nomFichier) {
monFlux.open(nomFichier, ios::in); monFlux.open(nomFichier, ios::in);
if (!monFlux) { if (!monFlux) {
cout << "Une erreur est survenue ! Veuillez relancer le programme."; cout << "Une erreur est survenue ! Veuillez relancer le programme.";
system("PAUSE");
exit(1); exit(1);
} }
} }
@@ -86,11 +90,26 @@ void curseur(bool interrupteur) {
/*==================================== /*====================================
1 - JOUER 1 - JOUER
====================================*/ ====================================*/
//Fonction pour connaitre le nombre de ligne d'un fichier
int nombreLigneFichier(fstream& monFlux) {
string str;
int nbLigne = 0;
while (!monFlux.eof()) {
getline(monFlux, str);
nbLigne++;
}
monFlux.seekg(ios::beg);
return nbLigne;
}
//fonction pour choisir le mot de facon random //fonction pour choisir le mot de facon random
string choisirMot(string nomFichier, int maximum) {//Choisi un mot al<61>atoire et le renvoi string choisirMot(string nomFichier) {//Choisi un mot al<61>atoire et le renvoi
int numeroLigne = rand() % (maximum)+1;
fstream monFlux; fstream monFlux;
ouvrirFichier(monFlux, nomFichier); ouvrirFichier(monFlux, nomFichier);
int maximum = nombreLigneFichier(monFlux);
int numeroLigne = rand() % (maximum)+1;
string motRandom = goToLine(monFlux, numeroLigne); string motRandom = goToLine(monFlux, numeroLigne);
fermerFichier(monFlux); fermerFichier(monFlux);
return motRandom; return motRandom;
@@ -104,52 +123,83 @@ string goToLine(fstream& monFlux, int numeroLigne) {//g
return mot; return mot;
} }
void effectuerTour() bool effectuerTour()
{ {
string motRandom = choisirMot("Mots/mot3lettres.txt", 15); string motRandom;
int nbBonneLettre = 0;
if (nbLettre == 3) {
motRandom = choisirMot("Mots/mot3lettres.txt");
}
else if (nbLettre == 4) {
motRandom = choisirMot("Mots/mot4lettres.txt");
}
cout << setw(83) << "=============================================\n"; cout << setw(83) << "=============================================\n";
string motPlayer; string motPlayer;
for (int nbTentative = 0; nbTentative < 6; nbTentative++) for (int nbTentative = 0; nbTentative < nbEssai; nbTentative++)
{ {
do string lettrePlayer;
{ do {
cout << setw(65) << "Tentative #" << nbTentative + 1 << endl; cout << setw(69) << "Tentative des mots de " << nbLettre << " #" << nbTentative + 1 << endl;
cout << setw(69) << "Saisir votre mot : "; cout << setw(69) << "Saisir votre mot : ";
cin >> motPlayer; cin >> motPlayer; //TODO: mettre tolower string (boucle)
} while (motPlayer.length() == 3); } while (motPlayer.length() != nbLettre);
if (dansListe(motPlayer)) nbBonneLettre = 0;
{ if (dansListe(motPlayer)) {
cout << "\nto continue\n";
//NE PAS EFFACER
//if (motRandom[0] == motPlayer[0])
//else if (motRandom[0] == motPlayer[1] || motPlayer[2])
cout << setw(66) << "Votre mot est : " << motPlayer << endl;
for (int i = 0; i < nbLettre; i++) {
if (lettreDansMot(motRandom, motPlayer, nbLettre, i) == BONNE_PLACE) {
lettrePlayer = motPlayer[i];
afficherMotPlayer(lettrePlayer, BONNE_PLACE);
nbBonneLettre++;
} }
else else if (lettreDansMot(motRandom, motPlayer, nbLettre, i) == MAUVAIS_PLACE) {
lettrePlayer = motPlayer[i];
afficherMotPlayer(lettrePlayer, MAUVAIS_PLACE);
}
else {
lettrePlayer = motPlayer[i];
afficherMotPlayer(lettrePlayer, PAS_LA);
}
}
if (nbBonneLettre == nbLettre)
{ {
cout << setw(58) << "\nMot n'est pas dans la liste\n"; afficherVictoire(motRandom);
return true;
}
cout << endl;
}
else {
cout << setw(66) << "Votre mot est : " << motPlayer;
cout << endl << setw(75) << "Mot n'est pas dans la liste\n\n"; //TODO: Ajouter dans essai.txt
nbTentative--; nbTentative--;
} }
} }
afficherDefaite(motRandom);
return false;
cout << setw(66) << "Votre mot est : " << motPlayer;
} }
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 < 15; i++) { //TODO changer le chiffre 15 par le num<75>ro de ligne dans le ficher int nbMots = 0;
getline(monFlux, mot); if (nbLettre == 3) {
ouvrirFichier(monFlux, "Mots/mot3lettres.txt");
}
else if (nbLettre == 4) {
ouvrirFichier(monFlux, "Mots/mot4lettres.txt");
}
nbMots = nombreLigneFichier(monFlux);
for (int i = 0; i < nbMots; i++) {
getline(monFlux, mot); //TODO: Verification d'erreur du getline (Exemple si le fichier est trops petit)
if (motPlayer == mot) if (motPlayer == mot)
{ {
@@ -162,51 +212,129 @@ bool dansListe(string motPlayer)
} }
int lettreDansMot(string motRandom, string motPlayer, int nbLettre, int i) {
int retour = PAS_LA;
for (int k = 0; k < nbLettre; k++) {
if (motRandom[k] == motPlayer[i] && i == k) {
return BONNE_PLACE;
}
else if ((motRandom[k] == motPlayer[i]) && i != k) {
retour = MAUVAIS_PLACE;
}
}
return retour;
}
//Affichage couleur des lettres
void afficherMotPlayer(string lettrePlayer, int positionLettre)
{
fstream monFlux;
string nomFichier;
HANDLE hconsole = GetStdHandle(STD_OUTPUT_HANDLE); //Pour la couleur
lettrePlayer.insert(0, "Alphabet/");
lettrePlayer.append(".txt");
nomFichier = lettrePlayer;
ouvrirFichier(monFlux, nomFichier);
printLettre(monFlux, positionLettre);
fermerFichier(monFlux);
}
void printLettre(fstream& monFlux, int positionLettre)
{
int couleurLettre;
if (positionLettre == BONNE_PLACE)
{
couleurLettre = 10;
}
else if (positionLettre == MAUVAIS_PLACE)
{
couleurLettre = 06;
}
else if (positionLettre == PAS_LA)
{
couleurLettre = 8;
}
else
{
exit(2);
}
const char carre = 219;
HANDLE hconsole = GetStdHandle(STD_OUTPUT_HANDLE); //D<>claration de variable pour les images
while (!monFlux.eof()) {
int val = 0;
monFlux >> val;
if (val == 00)
{
val = couleurLettre;
}
if (val == 99)
{
cout << endl;
}
else
{
SetConsoleTextAttribute(hconsole, val);
cout << carre << carre;
}
}
SetConsoleTextAttribute(hconsole, 15);
}
// Affichage victoire et d<>faite
void afficherVictoire(string motRandom) {
system("cls");
cout << "Felicitations, vous avez gagnez ! Le mot etais bien \"" << motRandom << "\" :D";
system("PAUSE>NUL");
}
void afficherDefaite(string motRandom) {
system("cls");
cout << "Dommage ! Meilleur chance la prochaine fois..."
<< endl
<< "Pour votre information, le mot a deviner etais \"" << motRandom << "\".";
system("PAUSE>NUL");
}
/*==================================== /*====================================
2 - OPTIONS 2 - OPTIONS
====================================*/ ====================================*/
void background(int couleur) { void choixNbEssai()
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE); {
cout << "Veuillez choisir le nombre de tentative que vous souhaitez avoir."
<< "\nPar defaut, le nombre de tentative est a 6."
<< endl
<< "Nombre de tentative : ";
cin >> nbEssai;
cout << "Vous avez choisi d'avoir " << nbEssai << " tentatives."
<< endl
<< endl;
}
switch (couleur) { void choixLongeurMot() {
case '1': cout << "Veuillez choisir la longueur des mots a deviner."
SetConsoleTextAttribute(hConsole, BACKGROUND_RED | BACKGROUND_INTENSITY); << "\nPar defaut, la longeur est a 3 lettres."
break; << "\n***Pour le moment, uniquement les mots de 3 et de 4 lettres fonctionnent.***"
<< endl
case '2': << "Longeur des mots : ";
SetConsoleTextAttribute(hConsole, BACKGROUND_RED); cin >> nbLettre;
break; if (nbLettre == 3 || nbLettre == 4) {
cout << "Vous avez choisi d'avoir " << nbLettre << " lettres dans les mots a trouver."
case '3': << endl
SetConsoleTextAttribute(hConsole, BACKGROUND_BLUE); << endl;
break; }
else {
case '4': nbLettre = 3;
SetConsoleTextAttribute(hConsole, BACKGROUND_GREEN); cout << "Choix non disponible, nous avons choisis pour vous. Les mots auront 3 lettres."
break; << endl
<< endl;
case '5':
//SetConsoleTextAttribute(hConsole, BACKGROUND_RED | BACKGROUND_INTENSITY);
break;
case '6':
//SetConsoleTextAttribute(hConsole, BACKGROUND_RED | BACKGROUND_INTENSITY);
break;
default:
SetConsoleTextAttribute(hConsole, BACKGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_RED | BACKGROUND_INTENSITY);
} }
} }
int demanderBackground() {
cout << "Choix";
int choix = _getche();
return choix;
}
void backgroundDefault() {
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hConsole, 0x0F);
}

View File

@@ -24,14 +24,26 @@ void afficherImage(fstream& monFlux);
void fermerFichier(fstream& monFlux); void fermerFichier(fstream& monFlux);
void delai(); void delai();
void curseur(bool interrupteur); void curseur(bool interrupteur);
void background(int couleur);
int demanderBackground(); int nombreLigneFichier(fstream& monFlux);
void backgroundDefault();
// Mot // Mot
string choisirMot(string nomFichier, int maximum); string choisirMot(string nomFichier);
string goToLine(fstream& monFlux, int numeroLigne); string goToLine(fstream& monFlux, int numeroLigne);
void effectuerTour(); bool effectuerTour();
bool dansListe(string motPlayer); bool dansListe(string motPlayer);
bool comparerMot(fstream& monFlux, string motPlayer, int numeroLigne); //bool comparerMot(fstream& monFlux, string motPlayer, int numeroLigne);
int lettreDansMot(string motRandom, string motPlayer, int nbLettre, int i);
void afficherMotPlayer(string lettrePlayer, int positionLettre);
void printLettre(fstream& monFlux, int positionLettre);
// Messages victoire et d<>faite
void afficherVictoire(string motRandom);
void afficherDefaite(string motRandom);
/*====================================
2 - OPTIONS
====================================*/
void choixNbEssai();
void choixLongeurMot();