diff --git a/clear.sh b/clear.sh index 6ea77dbc72b690fe82b1b68c7ad72bfecf39e11d..ec8a7fb79d25df53544649c182da64b4228b5579 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 1a60458b97508cc44b9844628615d1d30c31b36a..e0f47bac064c51a29a14d2635dec638a4f969096 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 25fd67e28c0c283254fccf0eeeafdb0d66680308..20e0d0fcd1af0b29d5d4af0063a1c398ba6ba429 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("""