Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
Labyrinthe-Perdu
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Florian Gambirasio
Labyrinthe-Perdu
Commits
2b6117a1
Commit
2b6117a1
authored
1 year ago
by
HydroFlo
Browse files
Options
Downloads
Patches
Plain Diff
AjoutQuestion
parent
b5e18694
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
S1.02/Jeu/classes/Labyrinthe.class
+0
-0
0 additions, 0 deletions
S1.02/Jeu/classes/Labyrinthe.class
S1.02/Jeu/ressources/ListeQuestion.csv
+5
-5
5 additions, 5 deletions
S1.02/Jeu/ressources/ListeQuestion.csv
S1.02/Jeu/src/Labyrinthe.java
+41
-10
41 additions, 10 deletions
S1.02/Jeu/src/Labyrinthe.java
with
46 additions
and
15 deletions
S1.02/Jeu/classes/Labyrinthe.class
+
0
−
0
View file @
2b6117a1
No preview for this file type
This diff is collapsed.
Click to expand it.
S1.02/Jeu/ressources/ListeQuestion.csv
+
5
−
5
View file @
2b6117a1
intitulé,réponse
intitulé,réponse
"Quelle est la capital de la France","paris"
Quelle est la capital de la France,paris
"Quelle est la capitale du Danemark ?","Copenhague"
Quelle est la capitale du Danemark ?,Copenhague
"Combien font 5 + 9","14"
Combien font 5 + 9,14
"Ecrire en chiffre : trois-cent-vight-deux","322"
Ecrire en chiffre : trois-cent-vight-deux,322
"En quelle année l'Amérique à été découverte par les européens ?","1492"
En quelle année l'Amérique à été découverte par les européens ?,1492
\ No newline at end of file
This diff is collapsed.
Click to expand it.
S1.02/Jeu/src/Labyrinthe.java
+
41
−
10
View file @
2b6117a1
...
@@ -19,7 +19,7 @@ class Labyrinthe extends Program{
...
@@ -19,7 +19,7 @@ class Labyrinthe extends Program{
};
};
Salle
newSalle
(
int
numero
,
String
sorties
){
Salle
newSalle
(
int
numero
,
String
sorties
){
//Création d'une salle
Salle
s
=
new
Salle
();
Salle
s
=
new
Salle
();
s
.
numero
=
numero
;
s
.
numero
=
numero
;
s
.
sorties
=
sorties
;
s
.
sorties
=
sorties
;
...
@@ -273,17 +273,40 @@ class Labyrinthe extends Program{
...
@@ -273,17 +273,40 @@ class Labyrinthe extends Program{
String
[][]
load
(
String
cheminFichier
){
//Charge un fichier csv en un tableau
String
[][]
load
(
String
cheminFichier
){
//Charge un fichier csv en un tableau
CSVFile
file
=
loadCSV
(
cheminFichier
);
CSVFile
file
=
loadCSV
(
cheminFichier
);
String
tab
[][]
=
new
String
[
rowCount
(
file
)
-
1
][
columnCount
(
file
)];
String
tab
[][]
=
new
String
[
rowCount
(
file
)][
columnCount
(
file
)];
for
(
int
i
=
0
;
i
<
rowCount
(
file
)
-
1
;
i
++){
for
(
int
i
=
0
;
i
<
rowCount
(
file
);
i
++){
for
(
int
j
=
0
;
j
<
columnCount
(
file
);
j
++){
for
(
int
j
=
0
;
j
<
columnCount
(
file
);
j
++){
tab
[
i
][
j
]
=
getCell
(
file
,
i
+
1
,
j
);
tab
[
i
][
j
]
=
getCell
(
file
,
i
,
j
);
}
}
}
}
return
tab
;
return
tab
;
}
}
void
ajoutQuestion
(
String
[][]
file
,
int
nbAjout
){
//Permet d'ajouter nbAjout nouvelle Question
String
[][]
newFile
=
new
String
[
length
(
file
,
1
)
+
nbAjout
][
length
(
file
,
2
)];
for
(
int
i1
=
0
;
i1
<
length
(
file
,
1
);
i1
++){
//copie le fichier de base
for
(
int
j1
=
0
;
j1
<
length
(
file
,
2
);
j1
++){
newFile
[
i1
][
j1
]
=
file
[
i1
][
j1
];
}
}
for
(
int
i
=
length
(
file
,
1
);
i
<
length
(
newFile
);
i
++){
//ajoute autant de question que demandé à l'appelle de la fonction
print
(
"Quel est l'intitulé de la nouvelle question ? : "
);
String
intitu
=
readString
();
print
(
"Quelle est la réponse à cette question ? : "
);
String
rep
=
readString
();
newFile
[
i
][
0
]=
intitu
;
newFile
[
i
][
1
]=
rep
;
}
saveCSV
(
newFile
,
"ressources/ListeQuestion.csv"
);
}
void
ajoutQuestion
(
String
[][]
file
,
int
valeur1
,
int
valeur2
){
}
void
afficheStringTab
(
String
[][]
tab
){
//Affiche un tableau de String a 2 dimension
void
afficheStringTab
(
String
[][]
tab
){
//Affiche un tableau de String a 2 dimension
for
(
int
i
=
0
;
i
<
length
(
tab
,
1
);
i
++){
for
(
int
i
=
1
;
i
<
length
(
tab
,
1
);
i
++){
for
(
int
j
=
0
;
j
<
length
(
tab
,
2
);
j
++){
for
(
int
j
=
0
;
j
<
length
(
tab
,
2
);
j
++){
print
(
tab
[
i
][
j
]
+
" "
);
print
(
tab
[
i
][
j
]
+
" "
);
}
}
...
@@ -347,27 +370,35 @@ class Labyrinthe extends Program{
...
@@ -347,27 +370,35 @@ class Labyrinthe extends Program{
}
}
void
algorithm
(){
void
algorithm
(){
Salle
[][]
lab
=
genererLab
(
5
);
//genere le Layrinthe
Salle
[][]
lab
=
genererLab
(
5
);
//genere le Layrinthe
String
[][]
lQuestion
=
load
(
"ressources/ListeQuestion.csv"
);
ajoutQuestion
(
lQuestion
,
1
);
lQuestion
=
load
(
"ressources/ListeQuestion.csv"
);
afficheStringTab
(
lQuestion
);
for
(
int
i
=
0
;
i
<
length
(
lab
,
1
);
i
++){
for
(
int
i
=
0
;
i
<
length
(
lab
,
1
);
i
++){
for
(
int
j
=
0
;
j
<
length
(
lab
,
2
);
j
++){
for
(
int
j
=
0
;
j
<
length
(
lab
,
2
);
j
++){
afficherSalle
(
lab
[
i
][
j
].
numero
);
afficherSalle
(
lab
[
i
][
j
].
numero
);
}
}
}
}
print
(
readFile
(
"ressources/img/Presentation.txt"
,
true
));
print
(
readFile
(
"ressources/img/Presentation.txt"
,
true
));
//affiche l'écran titre
String
lancer
=
readString
();
String
lancer
=
readString
();
while
(
lancer
!=
""
){
while
(
lancer
!=
""
){
//Vérifie que l'utilisateur fasse "Entrée" et si oui lance le jeu
print
(
readFile
(
"ressources/img/Presentation.txt"
,
true
));
print
(
readFile
(
"ressources/img/Presentation.txt"
,
true
));
lancer
=
readString
();
lancer
=
readString
();
}
}
print
(
"Rentrez votre pseudo : "
);
print
(
"Rentrez votre pseudo : "
);
String
pseudo
=
readString
();
String
pseudo
=
readString
();
Joueur
j
=
newJoueur
(
pseudo
);
Joueur
j
=
newJoueur
(
pseudo
);
//Création du joueur
println
(
""
+
j
.
pseudo
+
" / score : "
+
j
.
score
+
" / vie : "
+
j
.
vie
+
" / boss vaincu ? "
+
j
.
bossVaincu
);
println
(
""
+
j
.
pseudo
+
" / score : "
+
j
.
score
+
" / vie : "
+
j
.
vie
+
" / boss vaincu ? "
+
j
.
bossVaincu
);
char
[][]
salle
=
lab
[
0
][
0
];
char
[][]
salle
=
genererSalle
(
"ressources/Lab/Salle"
+
lab
[
0
][
0
].
numero
);
Question
q
=
newQuestion
(
"Quelle est la capital de la France"
,
"paris"
);
Question
q
=
newQuestion
(
"Quelle est la capital de la France"
,
"paris"
);
afficherSalle
(
lab
[
1
][
0
].
numero
);
afficherSalle
(
lab
[
1
][
0
].
numero
);
int
[]
indiceM
=
indiceDe
(
'P'
,
salle
1
);
int
[]
indiceM
=
indiceDe
(
'P'
,
salle
);
salle
[
indiceM
[
0
]-
1
][
indiceM
[
1
]]
=
'M'
;
salle
[
indiceM
[
0
]-
1
][
indiceM
[
1
]]
=
'M'
;
afficheStringTab
(
load
(
"ressources/score.csv"
));
afficheStringTab
(
load
(
"ressources/score.csv"
));
while
(
j
.
vie
>
0
&&
!
j
.
bossVaincu
){
while
(
j
.
vie
>
0
&&
!
j
.
bossVaincu
){
afficheLab
(
salle
);
afficheLab
(
salle
);
println
(
""
+
j
.
pseudo
+
" / score : "
+
j
.
score
+
" / vie : "
+
j
.
vie
+
" / boss vaincu ? "
+
j
.
bossVaincu
);
println
(
""
+
j
.
pseudo
+
" / score : "
+
j
.
score
+
" / vie : "
+
j
.
vie
+
" / boss vaincu ? "
+
j
.
bossVaincu
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment