Skip to content
Extraits de code Groupes Projets

Comparer les révisions

Les modifications sont affichées comme si la révision source était fusionnée avec la révision cible. En savoir plus sur la comparaison des révisions.

Source

Sélectionner le projet cible
No results found

Cible

Sélectionner le projet cible
  • barbier2016/condorcet
1 résultat
Afficher les modifications
Validations sur la source (2)
#!/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()
...@@ -2,7 +2,9 @@ ...@@ -2,7 +2,9 @@
# suppression des fichiers existants # suppression des fichiers existants
rm matrice_duels_partiel.yaml 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
rm graphe_partiel.dot.png rm graphe_partiel.dot.png
rm resultats_complets_bruts_shuf.txt rm resultats_complets_bruts_shuf.txt
...@@ -11,4 +13,5 @@ rm resultats_partiels_out.txt ...@@ -11,4 +13,5 @@ rm resultats_partiels_out.txt
rm temp.txt rm temp.txt
rm ligne_gagnants_partiels.txt rm ligne_gagnants_partiels.txt
rm condorcet_output_partiel.txt rm condorcet_output_partiel.txt
rm bulletin_multiline.txt
rm *.bak rm *.bak
463126 215413
476375 313364
434133 312737
573276 316424
333155 236341
144444 125323
314343 136422
341237 316125
374127 156413
457277 216524
777277 215413
143477 314237
516767 213245
431236 326315
324341 156425
453176 312323
222345 213313
133433 235314
537476 416435
365477 727717
341142 514326
573242 146413
666277 712277
667177 312245
133157 717777
571177 313333
665377 136524
744137 226416
215264 246513
452155 313333
554157 156223
433133 236415
345233 327515
141755 314424
436566 234615
453155 425636
232174 416536
371242 236415
473167 336516
441344 166435
353277 232214
133344 612435
145277 426315
232122 321333
671546 146321
124345 234414
331136 146312
773147 327714
142355 612435
644167 266513
467777 717777
744135 546616
233275 541263
266477 416324
357477 456616
565177 437517
233477 621334
453136 127727
664155 236514
344177 217377
477577 613526
777177 316626
455155 136323
771127 325125
417777 157312
663145 215436
444556 126424
245146 236214
132254 314526
245477 632146
474377 416335
475176 133323
233343 233212
774174 432516
457376 123313
456377 156323
453167 326413
456377 425113
134354 217737
122643 145223
777377 666166
144677 166231
221145 156423
563177 115323
246755 316542
754261 616236
774167 146231
546336 126432
513722 314424
657177 416636
377137 156324
335153 256313
751647 246213
444344 166122
777277 621345
143244 236415
445376 156232
554144 313323
347635 146523
764136 315424
137755 256413
475156 511234
346255 532565
166577 614325
564277 636315
563267 216435
633254 156342
444224 326415
371276 415326
774277 256415
777177 456616
564136 351262
111411 316425
347254 326124
555755 531563
777377 227314
333233 226516
114355 346514
242134 327715
441245 177341
516477 315424
432115 326514
555354 426537
332144 612336
434255 514325
231124 416325
776177 236514
375476 435616
356277 425144
466666 466415
647375 236415
376477 325114
676477 426314
232333 525124
256366 124232
477177 256314
131177 515226
333123 136132
564177 312777
777477 316415
312445 216435
772177 317324
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
...@@ -29,12 +29,29 @@ cat resultats_complets_bruts_shuf.txt | while read line; do ...@@ -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 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 # 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 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" echo -e "Graphe mis à jour.\n"
cp graphe_partiel_extended_avec_texte.png affichage.png
# on affiche le classement # on affiche le classement
sed -e/Schulze/\{ -e:1 -en\;b1 -e\} -ed condorcet_output_partiel.txt sed -e/Schulze/\{ -e:1 -en\;b1 -e\} -ed condorcet_output_partiel.txt
sleep 4 #sleep 1
done done
#echo "Fin. ${NUMERO_BULLETIN} bulletins ont été comptabilisés." #echo "Fin. ${NUMERO_BULLETIN} bulletins ont été comptabilisés."
...@@ -12,12 +12,12 @@ translate = { ...@@ -12,12 +12,12 @@ translate = {
} }
colors = { colors = {
"DemiiSel" : "#0C631E", "DemiiSel" : "#ffa500",
"EquIInoxE" : "#6AD5CF", "EquIInoxE" : "#1685e9",
"IILLEGAL" : "#1B56D3", "IILLEGAL" : "#000000",
"LiMiTeD" : "#FF00FF", "LiMiTeD" : "#01ff06",
"PRIISME" : "#EF7A37", "PRIISME" : "#ce1629",
"SobrIIÉté" : "#CF9F00" "SobrIIÉté" : "#a570d1"
} }
pos = { pos = {
...@@ -51,7 +51,7 @@ node [shape="plaintext"]; ...@@ -51,7 +51,7 @@ node [shape="plaintext"];
for liste in dic: for liste in dic:
for opp in dic[liste]["win"]: for opp in dic[liste]["win"]:
if dic[liste]["win"][opp] > dic[opp]["win"][liste]: if dic[liste]["win"][opp] > dic[opp]["win"][liste]:
o.write(liste + " -> " + opp + "[labeldistance=4 labelangle=-15 penwidth=1 headlabel=\"" + str(dic[liste]["win"][opp]) + ":" + str(dic[liste]["lose"][opp]) + "\" fontsize=9 color=\"" + colors[liste] + "\" fontcolor=\"" + colors[liste] + "\"]\n") o.write(liste + " -> " + opp + "[labeldistance=4 labelangle=-30 penwidth=1 headlabel=\"" + str(dic[liste]["win"][opp]) + ":" + str(dic[liste]["lose"][opp]) + "\" fontsize=9 color=\"" + colors[liste] + "\" fontcolor=\"" + colors[liste] + "\"]\n")
o.write("}\n") o.write("}\n")
o.close() o.close()
......