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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Florian Gambirasio
Labyrinthe-Perdu
Commits
eb3e5bb5
Commit
eb3e5bb5
authored
1 year ago
by
HydroFlo
Browse files
Options
Downloads
Patches
Plain Diff
ajout Score pas encore test
parent
562a9094
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
S1.02/Jeu/ressources/score.csv
+6
-6
6 additions, 6 deletions
S1.02/Jeu/ressources/score.csv
S1.02/Jeu/src/Labyrinthe.java
+19
-2
19 additions, 2 deletions
S1.02/Jeu/src/Labyrinthe.java
with
25 additions
and
8 deletions
S1.02/Jeu/ressources/score.csv
+
6
−
6
View file @
eb3e5bb5
Pseudo,Score
Hydro,150
Alex,300
Bob,10
Testeur,100
Popolipo,200
Margoulin,50
\ No newline at end of file
Hydro,38
Alex,37
Bob,37
Testeur,34
Popolipo,31
Margoulin,30
\ No newline at end of file
This diff is collapsed.
Click to expand it.
S1.02/Jeu/src/Labyrinthe.java
+
19
−
2
View file @
eb3e5bb5
...
...
@@ -433,12 +433,28 @@ class Labyrinthe extends Program{
newFile
[
i
][
0
]=
intitu
;
newFile
[
i
][
1
]=
rep
;
}
saveCSV
(
newFile
,
"ressources/ListeQuestion.csv"
,
'|'
);
saveCSV
(
newFile
,
"ressources/ListeQuestion.csv"
);
}
void
ajoutScore
(
String
[][]
file
,
String
pseudo
,
int
score
){
//ajout de Score (optionnel à faire plus tard)
if
(
score
>
file
[
length
(
file
,
1
)-
1
][
1
]){
int
i
=
0
;
//permet de compter d'ajouter les fichier de file dans newFile après ajout de ligne
String
[][]
newFile
=
new
String
[
length
(
file
,
1
)][
length
(
file
,
2
)];
for
(
int
i1
=
0
;
i1
<
length
(
file
,
1
);
i1
++){
//copie le fichier de base
if
(
score
>=
file
[
i1
][
1
]){
//ajoute le score du joueur a la place qu'il mérite (en cas d'égalité remplace l'ancien ;) )
newFile
[
i1
][
0
]
=
pseudo
;
newFile
[
i1
][
1
]
=
score
;
}
else
{
//sinon remet les ancienne ligne
for
(
int
j1
=
0
;
j1
<
length
(
file
,
2
);
j1
++){
newFile
[
i
][
j1
]
=
file
[
i
][
j1
];
}
i
=
i
+
1
;
//incrémente i pour savoir quelle ligne de l'ancien fichier ont été mise dans le nouveau
}
}
saveCSV
(
newFile
,
"ressources/score.csv"
);
}
}
void
afficheStringTab
(
String
[][]
tab
){
//Affiche un tableau de String a 2 dimension
...
...
@@ -612,6 +628,7 @@ class Labyrinthe extends Program{
int
tailleLab
=
nbFromString
(
3
);
Salle
[][]
lab
=
genererLab
(
tailleLab
);
//genere le Layrinthe
String
[][]
questionTemp
=
load
(
"ressources/ListeQuestion.csv"
);
String
[][]
tabScore
=
load
(
"ressources/score.csv"
);
print
(
"Voulez vous ajouter des question ? oui (o), non (autre) : "
);
boolean
ques
=
equals
(
toLowerCase
(
readString
()),
"o"
);
if
(
ques
){
...
...
@@ -644,7 +661,6 @@ class Labyrinthe extends Program{
Joueur
joueur
=
newJoueur
(
pseudo
);
//Création du joueur
int
[]
indiceSalle
=
new
int
[]{
0
,
0
};
char
[][]
salle
=
genererSalle
(
"ressources/Lab/Salle"
+
lab
[
indiceSalle
[
0
]][
indiceSalle
[
1
]].
numero
);
Question
q
=
newQuestion
(
"Quelle est la capital de la France"
,
"paris"
);
int
rando
=
(
int
)
(
random
()
*
3
)+
1
;
afficherSalle
(
lab
[
1
][
0
].
numero
);
salle
[
length
(
salle
,
1
)/
2
][
length
(
salle
,
2
)/
2
]
=
'P'
;
...
...
@@ -677,5 +693,6 @@ class Labyrinthe extends Program{
}
else
{
print
(
readFile
(
"ressources/img/Lose.txt"
,
true
));
}
ajoutScore
(
tabScore
,
joueur
.
pseudo
,
joueur
.
score
);
}
}
\ No newline at end of file
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