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
1831eb66
Commit
1831eb66
authored
1 year ago
by
HydroFlo
Browse files
Options
Downloads
Patches
Plain Diff
Question random (pas tester)
parent
cb35260d
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
S1.02/Jeu/classes/Labyrinthe.class
+0
-0
0 additions, 0 deletions
S1.02/Jeu/classes/Labyrinthe.class
S1.02/Jeu/src/Labyrinthe.java
+16
-6
16 additions, 6 deletions
S1.02/Jeu/src/Labyrinthe.java
with
16 additions
and
6 deletions
S1.02/Jeu/classes/Labyrinthe.class
+
0
−
0
View file @
1831eb66
No preview for this file type
This diff is collapsed.
Click to expand it.
S1.02/Jeu/src/Labyrinthe.java
+
16
−
6
View file @
1831eb66
...
...
@@ -364,7 +364,7 @@ class Labyrinthe extends Program{
}
}
void
afficheQuestion
(
Question
q
,
boolean
reponseLibre
){
void
afficheQuestion
(
Question
q
,
boolean
reponseLibre
){
//Affiche les questions
println
(
"################################################################################"
+
'\n'
+
"####@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@####"
+
'\n'
+
"####@ @####"
);
...
...
@@ -381,7 +381,7 @@ class Labyrinthe extends Program{
}
Question
[]
listeQuestion
(
String
cheminFichier
){
Question
[]
listeQuestion
(
String
cheminFichier
){
//Charge le csv des question et renvoie un tableau de question qui possède une Question par case
String
[][]
lQuestion
=
load
(
cheminFichier
);
Question
[]
res
=
new
Question
[
length
(
lQuestion
,
1
)-
1
];
for
(
int
i
=
0
;
i
<
length
(
res
);
i
++){
...
...
@@ -398,6 +398,15 @@ class Labyrinthe extends Program{
assertEquals
(
test2
.
question
,
tabTest
[
length
(
tabTest
)-
1
].
question
);
}
Question
questionRandom
(
Question
[]
liste
,
int
nbUtilisees
){
int
choix
=
(
int
)
(
random
()*
length
(
liste
)-
nbUtilisees
);
Question
res
=
liste
[
choix
];
Question
temp
=
liste
[
nbUtilisees
];
liste
[
choix
]
=
temp
;
liste
[
nbUtilisees
]
=
res
;
return
res
;
}
boolean
questionCorrect
(
Question
q
){
//Vérifie si on donne la bonne réponse
String
res
=
readString
();
return
equals
(
toLowerCase
(
res
),
toLowerCase
(
q
.
reponse
));
...
...
@@ -437,16 +446,17 @@ class Labyrinthe extends Program{
}
void
_algorithm
(){
Salle
[][]
lab
=
genererLab
(
5
);
//genere le Layrinthe
String
[][]
lQ
uestion
=
load
(
"ressources/ListeQuestion.csv"
);
String
[][]
q
uestion
Temp
=
load
(
"ressources/ListeQuestion.csv"
);
print
(
"Voulez vous ajouter des question ? oui (o), non (autre) : "
);
boolean
ques
=
equals
(
toLowerCase
(
readString
()),
"o"
);
if
(
ques
){
print
(
"Combien voulez vous en ajouter ? : "
);
int
nbAjout
=
readInt
();
ajoutQuestion
(
lQ
uestion
,
nbAjout
);
lQ
uestion
=
load
(
"ressources/ListeQuestion.csv"
);
afficheStringTab
(
lQ
uestion
);
ajoutQuestion
(
q
uestion
Temp
,
nbAjout
);
q
uestion
Temp
=
load
(
"ressources/ListeQuestion.csv"
);
afficheStringTab
(
q
uestion
Temp
);
}
Question
[]
lQuestion
=
listeQuestion
(
"ressources/ListeQuestion.csv"
);
for
(
int
i
=
0
;
i
<
length
(
lab
,
1
);
i
++){
for
(
int
j
=
0
;
j
<
length
(
lab
,
2
);
j
++){
...
...
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