Skip to content
Snippets Groups Projects
Commit 1c486076 authored by Gabrielle Van De Vijver's avatar Gabrielle Van De Vijver
Browse files

fonction borda et test

parent 2e2dbc08
Branches
No related tags found
No related merge requests found
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.
Please register or to comment