Skip to content
Snippets Groups Projects
Commit ecda74c1 authored by Eden PORTE's avatar Eden PORTE
Browse files

Merge branch 'master' of gitlab.utc.fr:porteede/ia04-td3-porte-hericourt

parents 13471133 ba6adfbb
No related branches found
No related tags found
No related merge requests found
package main
import (
"fmt"
"gitlab.utc.fr/porteede/ia04-td3-porte-hericourt/comsoc"
)
func ProfileAdd(p comsoc.Profile, nb int, order []comsoc.Alternative) comsoc.Profile {
for i := 0; i < nb; i++ {
p = append(p, order)
}
return p
}
func main() {
var p comsoc.Profile // exemple profil tiré du cours page 34
var c comsoc.Count
var err error
// Résultats attendus :
// Scrutin majoritaire simple : d
// Scrutin majoritaire à deux tours : a
// Règle de Borda : b
// Gagnant de Condorcet : c
p = ProfileAdd(p, 5, []comsoc.Alternative{0, 1, 2, 3})
p = ProfileAdd(p, 4, []comsoc.Alternative{0, 2, 1, 3})
p = ProfileAdd(p, 2, []comsoc.Alternative{3, 1, 0, 2})
p = ProfileAdd(p, 6, []comsoc.Alternative{3, 1, 2, 0})
p = ProfileAdd(p, 8, []comsoc.Alternative{2, 1, 0, 3})
p = ProfileAdd(p, 2, []comsoc.Alternative{3, 2, 1, 0})
//fmt.Println(comsoc.rank(1, p[6]))
c, err = comsoc.MajoritySWF(p)
fmt.Println(c, err) // c[1] n'existe pas mais affiche 0-value donc ça marche
fmt.Println(comsoc.MajoritySCF(p))
fmt.Println(comsoc.BordaSWF(p))
fmt.Println(comsoc.BordaSCF(p))
fmt.Println(comsoc.CondorcetWinner(p))
fmt.Println(comsoc.CopelandSWF(p))
}
......@@ -3,8 +3,8 @@ Auteurs : Gwendal HERICOURT, Eden PORTE
## Lancement
```shell
go install gitlab.utc.fr/porteede/ia04-td3-porte-hericourt@latest
cd $HOME/go/pkg/gitlab.utc.fr/porteede/ia04-td3-porte-hericourt
go install gitlab.utc.fr/porteede/ia04-td3-porte-hericourt@v1.0.0
cd $HOME/go/pkg/gitlab.utc.fr/porteede/ia04-td3-porte-hericourt@v1.0.0
go run cmd/launch/launch-all-agents.go
```
......
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