From 4d31d72c0943e28864f86d02359143420077f47a Mon Sep 17 00:00:00 2001 From: Phokopi <phokopi@mail.ru> Date: Tue, 18 Oct 2022 22:07:08 +0200 Subject: [PATCH] Autres modifs FR (encore) --- clear.sh | 4 ++-- script.sh | 12 ++++++------ toDot.py | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/clear.sh b/clear.sh index 6ea77db..ec8a7fb 100644 --- a/clear.sh +++ b/clear.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # suppression des fichiers existants -rm matrice_duels.yaml +rm matrice_duels_partiel.yaml rm graphe_partiel_avec_texte.png rm graphe_partiel.dot rm graphe_partiel.dot.png @@ -10,5 +10,5 @@ rm resultats_partiels_bruts.txt rm resultats_partiels_out.txt rm temp.txt rm ligne_gagnants_partiels.txt -rm condorcet_output.txt +rm condorcet_output_partiel.txt rm *.bak diff --git a/script.sh b/script.sh index 1a60458..e0f47ba 100644 --- a/script.sh +++ b/script.sh @@ -23,17 +23,17 @@ cat resultats_complets_bruts_shuf.txt | while read line; do # affichage du bulletin en cours BALLOT=$(tail -1 resultats_partiels_out.txt) echo -e "Bulletin n°${NUMERO_BULLETIN} : ${BALLOT}\n" - # utilisation de l'appli condorcet, on stocke le résultat dans le fichiet condorcet_output.txt - ./vendor/bin/condorcet election --candidates candidates.txt --votes resultats_partiels_out.txt SchulzeWinning -p > 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_partiel.txt # 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 - # 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 - 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 -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_partiel.yaml, puis appelle toDot.py pour générer l'image du graphe dans graphe_partiel.dot.png + 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 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" # 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 done diff --git a/toDot.py b/toDot.py index 25fd67e..20e0d0f 100644 --- a/toDot.py +++ b/toDot.py @@ -40,7 +40,7 @@ f = open("ligne_gagnants_partiels.txt", "r") lineWinners = f.readlines()[0] 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) o = open("graphe_partiel.dot", "w") o.write(""" -- GitLab