Skip to content
Snippets Groups Projects
Commit 5575017e authored by Balthazar Wilson's avatar Balthazar Wilson
Browse files

infinite simu with -1 maxstep

parent c64005ad
No related branches found
No related tags found
No related merge requests found
...@@ -227,12 +227,22 @@ func (simu *Simulation) Run() { ...@@ -227,12 +227,22 @@ func (simu *Simulation) Run() {
for _, agent := range simu.Agents { for _, agent := range simu.Agents {
go func(agent agt.Agent) { go func(agent agt.Agent) {
step := 0 step := 0
for step < simu.maxStep { if simu.maxStep < 0 {
step++ for {
c, _ := simu.syncChans.Load(agent.ID()) step++
c.(chan int) <- step c, _ := simu.syncChans.Load(agent.ID())
time.Sleep(500 * time.Millisecond) c.(chan int) <- step
<-c.(chan int) time.Sleep(500 * time.Millisecond)
<-c.(chan int)
}
} else {
for step < simu.maxStep {
step++
c, _ := simu.syncChans.Load(agent.ID())
c.(chan int) <- step
time.Sleep(500 * time.Millisecond)
<-c.(chan int)
}
} }
}(agent) }(agent)
} }
......
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