Skip to content
Snippets Groups Projects
Commit eed5bbca authored by Gabrielle Van De Vijver's avatar Gabrielle Van De Vijver Committed by Balthazar Wilson
Browse files

fonction borda et test

parent 01e78215
No related branches found
No related tags found
1 merge request!7Partie serveur
package comsoc
\ No newline at end of file
package comsoc
import("fmt")
func BordaSWF(p Profile) (count Count, err error){
count = make(Count)
nAlts := len(p[0])
for _, row := range p{
for i:=0; i<nAlts;i++{
count[row[i]]+=nAlts-i
}
}
return count,nil
}
func BordaSCF(p Profile) (bestAlts []Alternative, err error) {
count, err := BordaSWF(p)
if err != nil {
return nil, err
}
return maxCount(count), nil
}
func Test_borda(){
profil := GenerateProfile(3,5)
fmt.Println("Profil :", profil)
count,_ := BordaSWF(profil)
fmt.Println("Décompte :", count)
winners,_ := BordaSCF(profil)
fmt.Println("Vainqueur(s) :", winners)
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment