Skip to content
Extraits de code Groupes Projets
Valider 4d31d72c rédigé par Phokopi's avatar Phokopi
Parcourir les fichiers

Autres modifs FR (encore)

parent 47ff0da4
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
#!/usr/bin/env bash #!/usr/bin/env bash
# suppression des fichiers existants # suppression des fichiers existants
rm matrice_duels.yaml rm matrice_duels_partiel.yaml
rm graphe_partiel_avec_texte.png rm graphe_partiel_avec_texte.png
rm graphe_partiel.dot rm graphe_partiel.dot
rm graphe_partiel.dot.png rm graphe_partiel.dot.png
...@@ -10,5 +10,5 @@ rm resultats_partiels_bruts.txt ...@@ -10,5 +10,5 @@ rm resultats_partiels_bruts.txt
rm resultats_partiels_out.txt rm resultats_partiels_out.txt
rm temp.txt rm temp.txt
rm ligne_gagnants_partiels.txt rm ligne_gagnants_partiels.txt
rm condorcet_output.txt rm condorcet_output_partiel.txt
rm *.bak rm *.bak
...@@ -23,17 +23,17 @@ cat resultats_complets_bruts_shuf.txt | while read line; do ...@@ -23,17 +23,17 @@ cat resultats_complets_bruts_shuf.txt | while read line; do
# affichage du bulletin en cours # affichage du bulletin en cours
BALLOT=$(tail -1 resultats_partiels_out.txt) BALLOT=$(tail -1 resultats_partiels_out.txt)
echo -e "Bulletin n°${NUMERO_BULLETIN} : ${BALLOT}\n" echo -e "Bulletin n°${NUMERO_BULLETIN} : ${BALLOT}\n"
# utilisation de l'appli condorcet, on stocke le résultat dans le fichiet condorcet_output.txt # utilisation de l'appli condorcet, on stocke le résultat dans le fichiet condorcet_output_partiel.txt
./vendor/bin/condorcet election --candidates candidates.txt --votes resultats_partiels_out.txt SchulzeWinning -p > condorcet_output.txt ./vendor/bin/condorcet election --candidates candidates.txt --votes resultats_partiels_out.txt SchulzeWinning -p > condorcet_output_partiel.txt
# On stocke la ligne du ou des gagnants dans ligne_gagnants_partiels.txt, à traiter dans toDot.py # On stocke la ligne du ou des gagnants dans ligne_gagnants_partiels.txt, à traiter dans toDot.py
sed -e/Schulze/\{ -e:1 -en\;b1 -e\} -ed condorcet_output.txt > temp.txt && sed 4!d temp.txt > ligne_gagnants_partiels.txt sed -e/Schulze/\{ -e:1 -en\;b1 -e\} -ed condorcet_output_partiel.txt > temp.txt && sed 4!d temp.txt > ligne_gagnants_partiels.txt
# On extrait la matrice des duels vers matrice_duels.yaml, puis appelle toDot.py pour générer l'image du graphe dans graphe_partiel.dot.png # On extrait la matrice des duels vers matrice_duels_partiel.yaml, puis appelle toDot.py pour générer l'image du graphe dans graphe_partiel.dot.png
sed '/For/,$!d' condorcet_output.txt > temp.txt && sed 1,2d temp.txt -i && sed '/+-/,$d' temp.txt -i && sed -r 's/\|//g' temp.txt > matrice_duels.yaml && ./toDot.py sed '/For/,$!d' condorcet_output_partiel.txt > temp.txt && sed 1,2d temp.txt -i && sed '/+-/,$d' temp.txt -i && sed -r 's/\|//g' temp.txt > matrice_duels_partiel.yaml && ./toDot.py
# création de l'image avec texte numéro bulletin dans graphe_partiel_avec_texte.png # création de l'image avec texte numéro bulletin dans graphe_partiel_avec_texte.png
convert -fill black -pointsize 60 -draw "text 15,70 '${NUMERO_BULLETIN}/${NB_BULLETIN_TOTAL}'" graphe_partiel.dot.png graphe_partiel_avec_texte.png convert -fill black -pointsize 60 -draw "text 15,70 '${NUMERO_BULLETIN}/${NB_BULLETIN_TOTAL}'" graphe_partiel.dot.png graphe_partiel_avec_texte.png
echo -e "Graphe mis à jour.\n" echo -e "Graphe mis à jour.\n"
# on affiche le classement # on affiche le classement
sed -e/Schulze/\{ -e:1 -en\;b1 -e\} -ed condorcet_output.txt sed -e/Schulze/\{ -e:1 -en\;b1 -e\} -ed condorcet_output_partiel.txt
#sleep 2 #sleep 2
done done
......
...@@ -40,7 +40,7 @@ f = open("ligne_gagnants_partiels.txt", "r") ...@@ -40,7 +40,7 @@ f = open("ligne_gagnants_partiels.txt", "r")
lineWinners = f.readlines()[0] lineWinners = f.readlines()[0]
winners = lineWinners.split(" | ")[1].split("*")[0].split(" ")[0].split(",") winners = lineWinners.split(" | ")[1].split("*")[0].split(" ")[0].split(",")
with open('matrice_duels.yaml','r') as data: with open('matrice_duels_partiel.yaml','r') as data:
dic = yaml.safe_load(data) dic = yaml.safe_load(data)
o = open("graphe_partiel.dot", "w") o = open("graphe_partiel.dot", "w")
o.write(""" o.write("""
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter