diff --git a/classement_to_multiline.py b/classement_to_multiline.py new file mode 100644 index 0000000000000000000000000000000000000000..2bc194e2a0f3de8a0217021fffbf0041200a621e --- /dev/null +++ b/classement_to_multiline.py @@ -0,0 +1,15 @@ +#!/usr/bin/python3 + +import sys + +bulletin = sys.argv[1] + +ligne = bulletin.split(" > ") + +o = open("bulletin_multiline.txt", "w") +compteur = 1 +while compteur < len(ligne) + 1: + o.write(str(compteur) + ". " + ligne[compteur - 1].replace(" = ", ", ")) + o.write("\n") + compteur = compteur + 1 +o.close() diff --git a/clear.sh b/clear.sh index ec8a7fb79d25df53544649c182da64b4228b5579..913325c60862310a51f3ebc549b29bdfce57d1f8 100644 --- a/clear.sh +++ b/clear.sh @@ -2,7 +2,9 @@ # suppression des fichiers existants rm matrice_duels_partiel.yaml -rm graphe_partiel_avec_texte.png +rm affichage.png +rm graphe_partiel_extended.png +rm graphe_partiel_extended_avec_texte.png rm graphe_partiel.dot rm graphe_partiel.dot.png rm resultats_complets_bruts_shuf.txt @@ -11,4 +13,5 @@ rm resultats_partiels_out.txt rm temp.txt rm ligne_gagnants_partiels.txt rm condorcet_output_partiel.txt +rm bulletin_multiline.txt rm *.bak diff --git a/resultats_complets_bruts.txt b/resultats_complets_bruts.txt index 3b16877c2db032d37239e1ad071f1d66ea5b292e..1c04234b53508348f30c7f92fb652ebcf9220c33 100644 --- a/resultats_complets_bruts.txt +++ b/resultats_complets_bruts.txt @@ -1,171 +1,142 @@ -463126 -476375 -434133 -573276 -333155 -144444 -314343 -341237 -374127 -457277 -777277 -143477 -516767 -431236 -324341 -453176 -222345 -133433 -537476 -365477 -341142 -573242 -666277 -667177 -133157 -571177 -665377 -744137 -215264 -452155 -554157 -433133 -345233 -141755 -436566 -453155 -232174 -371242 -473167 -441344 -353277 -133344 -145277 -232122 -671546 -124345 -331136 -773147 -142355 -644167 -467777 -744135 -233275 -266477 -357477 -565177 -233477 -453136 -664155 -344177 -477577 -777177 -455155 -771127 -417777 -663145 -444556 -245146 -132254 -245477 -474377 -475176 -233343 -774174 -457376 -456377 -453167 -456377 -134354 -122643 -777377 -144677 -221145 -563177 -246755 -754261 -774167 -546336 -513722 -657177 -377137 -335153 -751647 -444344 -777277 -143244 -445376 -554144 -347635 -764136 -137755 -475156 -346255 -166577 -564277 -563267 -633254 -444224 -371276 -774277 -777177 -564136 -111411 -347254 -555755 -777377 -333233 -114355 -242134 -441245 -516477 -432115 -555354 -332144 -434255 -231124 -776177 -375476 -356277 -466666 -647375 -376477 -676477 -232333 -256366 -477177 -131177 -333123 -564177 -777477 -312445 -772177 -452176 -125377 -543133 -234765 -352124 -564366 -343645 -333143 -631264 -673177 -271576 -321344 -354576 -775154 -777377 -352122 -254376 -737145 -457177 -777777 -766126 -254677 -315174 -174576 -435766 -131333 -777177 -473756 -126377 +215413 +313364 +312737 +316424 +236341 +125323 +136422 +316125 +156413 +216524 +215413 +314237 +213245 +326315 +156425 +312323 +213313 +235314 +416435 +727717 +514326 +146413 +712277 +312245 +717777 +313333 +136524 +226416 +246513 +313333 +156223 +236415 +327515 +314424 +234615 +425636 +416536 +236415 +336516 +166435 +232214 +612435 +426315 +321333 +146321 +234414 +146312 +327714 +612435 +266513 +717777 +546616 +541263 +416324 +456616 +437517 +621334 +127727 +236514 +217377 +613526 +316626 +136323 +325125 +157312 +215436 +126424 +236214 +314526 +632146 +416335 +133323 +233212 +432516 +123313 +156323 +326413 +425113 +217737 +145223 +666166 +166231 +156423 +115323 +316542 +616236 +146231 +126432 +314424 +416636 +156324 +256313 +246213 +166122 +621345 +236415 +156232 +313323 +146523 +315424 +256413 +511234 +532565 +614325 +636315 +216435 +156342 +326415 +415326 +256415 +456616 +351262 +316425 +326124 +531563 +227314 +226516 +346514 +327715 +177341 +315424 +326514 +426537 +612336 +514325 +416325 +236514 +435616 +425144 +466415 +236415 +325114 +426314 +525124 +124232 +256314 +515226 +136132 +312777 +316415 +216435 +317324 diff --git a/script.sh b/script.sh index a5e2ba5b1aa3a9a3dcea169b0caaffcbc9fe0a7c..21ad16e9d5d0d10ecccb65fcad5605a98417c43b 100644 --- a/script.sh +++ b/script.sh @@ -29,12 +29,29 @@ cat resultats_complets_bruts_shuf.txt | while read line; do 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 + + # on étend l'image pour avoir la place d'écrire le bulletin + WIDTH=$(identify -format "%w\n" graphe_partiel.dot.png) + HEIGHT=$(identify -format "%h\n" graphe_partiel.dot.png) + convert -resize $((${WIDTH} + 1200))x${HEIGHT} -background White -gravity West -extent $((${WIDTH} + 1200))x${HEIGHT} graphe_partiel.dot.png graphe_partiel_extended.png + + # Ajout du numéro bulletin en cours dans graphe_partiel_avec_texte.png + convert -fill black -pointsize 55 -draw "text $((${WIDTH} + 30)),90 'Bulletin ${NUMERO_BULLETIN} / ${NB_BULLETIN_TOTAL}'" graphe_partiel_extended.png graphe_partiel_extended_avec_texte.png + + # on utilise classement_to_multiline.py pour avoir le bulletin sous forme multiline dans le fichier bulletin_multiline.txt + ./classement_to_multiline.py "$(tail -1 resultats_partiels_out.txt)" + # on écrit chaque ligne sur l'image + nbLignesEcrites=0 + cat bulletin_multiline.txt | while read classement_ligne; do + nbLignesEcrites=$(($nbLignesEcrites+1)) + convert -fill black -pointsize 40 -draw "text $((${WIDTH} + 30)),$((100 + $nbLignesEcrites*100)) '$classement_ligne'" graphe_partiel_extended_avec_texte.png graphe_partiel_extended_avec_texte.png + done + echo -e "Graphe mis à jour.\n" + cp graphe_partiel_extended_avec_texte.png affichage.png # on affiche le classement sed -e/Schulze/\{ -e:1 -en\;b1 -e\} -ed condorcet_output_partiel.txt - sleep 4 + #sleep 1 done #echo "Fin. ${NUMERO_BULLETIN} bulletins ont été comptabilisés." diff --git a/toDot.py b/toDot.py index 37604e608f1b8e2aaa0eabc9c28d9e3e170baac6..0fd6c7404619025c4584b213b9623bd1cbede8a9 100644 --- a/toDot.py +++ b/toDot.py @@ -12,12 +12,12 @@ translate = { } colors = { - "DemiiSel" : "#0C631E", - "EquIInoxE" : "#6AD5CF", - "IILLEGAL" : "#1B56D3", - "LiMiTeD" : "#FF00FF", - "PRIISME" : "#EF7A37", - "SobrIIÉté" : "#CF9F00" + "DemiiSel" : "#ffa500", + "EquIInoxE" : "#1685e9", + "IILLEGAL" : "#000000", + "LiMiTeD" : "#01ff06", + "PRIISME" : "#ce1629", + "SobrIIÉté" : "#a570d1" } pos = {