Skip to content
Snippets Groups Projects
Commit 7b5634e6 authored by julienpillis's avatar julienpillis
Browse files

correction setUp

parent 547b5986
No related branches found
No related tags found
1 merge request!14Merge v2
......@@ -114,11 +114,11 @@ func (c *Controleur) Act(ag *Agent) {
func (c *Controleur) SetUpAleaDestination(ag *Agent) {
rand.Seed(time.Now().UnixNano()) // le générateur de nombres aléatoires
randomRow := rand.Intn(len(ag.env.station[0])) // Génère un entier aléatoire entre 0 et 19
randomCol := rand.Intn(len(ag.env.station[1])) // Génère un entier aléatoire entre 0 et 19
randomRow := rand.Intn(len(ag.env.station[0])) // Génère un entier aléatoire entre 0 et 49
randomCol := rand.Intn(len(ag.env.station[1])) // Génère un entier aléatoire entre 0 et 49
for ag.env.station[randomRow][randomCol] != "_" {
randomRow = rand.Intn(len(ag.env.station[0])) // Génère un entier aléatoire entre 0 et 19
randomCol = rand.Intn(len(ag.env.station[1])) // Génère un entier aléatoire entre 0 et 19
randomRow = rand.Intn(len(ag.env.station[0])) // Génère un entier aléatoire entre 0 et 49
randomCol = rand.Intn(len(ag.env.station[1])) // Génère un entier aléatoire entre 0 et 49
}
ag.destination = alg.Coord{randomRow, randomCol}
}
......
......@@ -114,7 +114,7 @@ func (mr *MobiliteReduite) Act(ag *Agent) {
* Fonction qui permet de définir la destination d'un agent à mobilité réduite
*/
func (mr *MobiliteReduite) SetUpAleaDestination(ag *Agent) {
choix_voie := rand.Intn(2) // choix de la voie de métro aléatoire
choix_voie := rand.Intn(len(ag.env.metros)) // choix de la voie de métro aléatoire
dest_porte := (mr.findNearestGates(ag, ag.env.metros[choix_voie].way.gates))
//fmt.Println("[MobiliteReduite, setUpDestination] dest_porte = ",dest_porte)
ag.destination = dest_porte[0].Position
......
......@@ -131,7 +131,7 @@ func (un *UsagerNormal) SetUpAleaDestination(ag *Agent) {
//t := rand.Intn(10) +1
//time.Sleep(time.Duration(t) * time.Second) // "cool down"
//fmt.Println("[UsagerNormal, setUpDestination] setUpDestination")
choix_voie := rand.Intn(2) // choix de la voie de métro aléatoire
choix_voie := rand.Intn(len(ag.env.metros)) // choix de la voie de métro aléatoire
dest_porte := (un.findBestGate(ag, ag.env.metros[choix_voie].way.gates))
ag.destination = dest_porte
}
......
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