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 @@
# 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
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
......@@ -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."
......@@ -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 = {
......@@ -51,7 +51,7 @@ node [shape="plaintext"];
for liste in dic:
for opp in dic[liste]["win"]:
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.close()
......