Skip to content
This repository has been archived by the owner on May 17, 2024. It is now read-only.

Commit

Permalink
Creation fichier score
Browse files Browse the repository at this point in the history
  • Loading branch information
NilsKrattinger committed Jan 24, 2019
1 parent a584dc1 commit 50e1efc
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
12 changes: 9 additions & 3 deletions p_combinaisons.adb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
with sequential_IO;
with text_io; use text_io;
with sequential_IO, p_jeu;
with text_io; use text_io, p_jeu, p_jeu.p_score_io;


package body p_combinaisons is
Expand Down Expand Up @@ -287,8 +287,14 @@ package body p_combinaisons is
-- {Génère Fout.txt et foutcont.txt contenant respectivement toutes les solutions et les solutions contigües}
f: p_cases_io.file_type;
fout, foutcont: text_io.file_type;

fscore : p_score_io.file_type;
begin
begin
open(fscore, IN_FILE,"score");
exception
when others => create(fscore, IN_FILE, "score");
end;
close(fscore);
open(f, IN_FILE, "CarreGaudi");
CreeVectGaudi(f, V);
triVectGaudi(V);
Expand Down
9 changes: 5 additions & 4 deletions p_jeu.adb
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,18 @@ package body p_jeu is

procedure enregistrerScore(score: in TR_Score) is
-- {} => {le score a été enregistré dans le fichier de scores}
f: p_score_io.file_type;
f :p_score_io.file_type;
begin
create(f, APPEND_FILE, "score");
open(f, APPEND_FILE, "score");
write(f, score);
close(f);
end enregistrerScore;

procedure finJeu(abandon: in boolean) is
-- {} => {Finit le jeu}
begin
if not abandon then enregistrerScore((pseudo, compterPoints)); end if;
-- if not abandon then
enregistrerScore((pseudo, compterPoints));-- end if;
delete(fichierJeu);
close(fichierSolution);
end finJeu;
Expand Down Expand Up @@ -124,7 +125,7 @@ end Nbscores;
while permutation loop
permutation := false;
for j in reverse i+1..V'last loop
if V(j).score < V(j-1).score then
if V(j).score > V(j-1).score then
permut(V(j), V(j-1));
permutation := true;
end if;
Expand Down
4 changes: 2 additions & 2 deletions p_vue_graph.adb
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ package body p_vue_graph is
triBullesScores(VScore);
fenetre:= DebutFenetre("Scoreboard",500,600);
while i <= 10 and i <= VScore'last loop
ajouterTexte(fenetre, "Joueurs" &integer'image(i) , " Joueur : " & VScore(i).pseudo, 50,50 + (50*i),250,130);
ajouterTexte(fenetre, "Score" &integer'image(i) , "Points : " & integer'image(VScore(i).Score), 250,50 + (50*i),3200,130);
ajouterTexte(fenetre, "Joueurs" &integer'image(i) , " Joueur : " & VScore(i).pseudo, 50,50 + (50*i),250,30);
ajouterTexte(fenetre, "Score" &integer'image(i) , "Points : " & integer'image(VScore(i).Score), 250,50 + (50*i),250,30);
i := i+1;
end loop;
ajouterBouton(fenetre, "valider", "Valider", 200 , 560 , 100 , 30);
Expand Down

0 comments on commit 50e1efc

Please sign in to comment.