From 73b82689e6f3d9c20cd01b7cd3bb7d285a1916af Mon Sep 17 00:00:00 2001 From: jrafei <jana.eltayeb-el-rafei@etu.utc.fr> Date: Fri, 15 Dec 2023 23:18:56 +0100 Subject: [PATCH] merge_with_main --- cmd/simu/main.go | 2 +- internal/simulation/agent.go | 7 ++++--- internal/simulation/simu.go | 4 +++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/cmd/simu/main.go b/cmd/simu/main.go index 9c17dba..c29a1f6 100644 --- a/cmd/simu/main.go +++ b/cmd/simu/main.go @@ -6,7 +6,7 @@ import ( ) func main() { - s := simulation.NewSimulation(20, -1, 600*time.Second) + s := simulation.NewSimulation(1, -1, 600*time.Second) //go simulation.StartAPI(s) s.Run() } diff --git a/internal/simulation/agent.go b/internal/simulation/agent.go index ce42031..29bc343 100644 --- a/internal/simulation/agent.go +++ b/internal/simulation/agent.go @@ -51,15 +51,16 @@ type Agent struct { width int height int orientation int //0 : vers le haut, 1 : vers la droite, 2 : vers le bas, 3 : vers la gauche + path []alg.Node request *Request + // visitedPanneaux map[alg.Node]bool + // visiting *alg.Node } type Request struct { demandeur AgentID decision int - path []alg.Node - // visitedPanneaux map[alg.Node]bool - // visiting *alg.Node + } diff --git a/internal/simulation/simu.go b/internal/simulation/simu.go index 32c9665..1f86e93 100644 --- a/internal/simulation/simu.go +++ b/internal/simulation/simu.go @@ -97,13 +97,15 @@ func NewSimulation(agentCount int, maxStep int, maxDuration time.Duration) (simu syncChan := make(chan int) //ag := NewAgent(id, &simu.env, syncChan, time.Duration(time.Second), 0, true, Coord{0, 8 + i%2}, Coord{0, 8 + i%2}, &UsagerLambda{}, Coord{0, 8 + i%2}, Coord{12 - 4*(i%2), 18 - 15*(i%2)}) - //ag := NewAgent(id, &simu.env, syncChan, 1000, 0, true, &UsagerLambda{}, Coord{3, 4}, Coord{18, 12}, 2, 1) + ag := NewAgent(id, &simu.env, syncChan, 1000, 0, true, &UsagerLambda{}, Coord{18, 4}, Coord{0, 8}, 2, 1) + /* ag := &Agent{} if i%2==0{ ag = NewAgent(id, &simu.env, syncChan, 1000, 0, true, &UsagerLambda{}, Coord{18, 4}, Coord{0, 8}, 2, 1) }else{ ag = NewAgent(id, &simu.env, syncChan, 1000, 0, true, &UsagerLambda{}, Coord{1, 8}, Coord{8, 5}, 1, 1) } + */ //ag := NewAgent(id, &simu.env, syncChan, 1000, 0, true, &UsagerLambda{}, Coord{1, 17}, Coord{0, 0}, 2, 1) -- GitLab