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() {
for _, agent := range simu.Agents {
go func(agent agt.Agent) {
step := 0
for step < simu.maxStep {
step++
c, _ := simu.syncChans.Load(agent.ID())
c.(chan int) <- step
time.Sleep(500 * time.Millisecond)
<-c.(chan int)
if simu.maxStep < 0 {
for {
step++
c, _ := simu.syncChans.Load(agent.ID())
c.(chan int) <- step
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)
}
......
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