diff --git a/simu/simu.go b/simu/simu.go index d8d4491cc83dd8022add45b987b659dfa8df39ab..2d0befaf00ec838a6577556c4995ea657dbeea51 100644 --- a/simu/simu.go +++ b/simu/simu.go @@ -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) }