1

Netlogo Simulation does not workI'm trying to make a simulation in NetLogo, where an evacuation takes place. At the moment, all the turtles walk to the doors, but I have no idea how to continue from here on, because it just is not consistent. Can someone help me?

I already did research, but every time I try to get the turtles out of the rooms, the won't go any further. Also, when is let them face to the right of te middle corridor (gang in Dutch), and try to let them walk forward, it does not work.

we.tl/t-sN8JJyO4El

to move
  let target patch-ahead 1

  while [([pcolor] of target = blue) or (target = 
  nobody)]
    [ left random 360 ]
  move-to target
end

And this code do I have for the turtles on all rooms:

  ask turtles-on lokaal1 [
    face min-one-of patches with [pxcor < -11 and 
    pxcor > -15 and pycor < 4 and pycor > 2] [distance myself] 
    move
]

I tried the next thing to see if it works:

  to move
    let target patch-ahead 1
    while [([pcolor] of target = blue) or (target = nobody)]
      [ left random 360
        set target patch-ahead 1
        set color red]

    move-to target
  end

But it still doesn't. When is change target = nobody to target != nobody, it simply crashes

Everyone walks to the door, but there they all go stand on the door together and don't watch out or wait for eachother.

Also, for some reason some turtles just randomly disappear and sometimes appear again.

  • Could not place code, so used a wetransfer link. Hope this works. First time using StackOverflow – Bram Hesselink Mar 24 '22 at 20:03
  • Welcome to StackOverflow! You should add the code directly to your question and describe where you think the problem is. – Jasper Mar 25 '22 at 14:29
  • Yes, I added it! Can you maybe help me? – Bram Hesselink Mar 25 '22 at 16:31
  • I checked the code in your wetransfer link and the problem there is that you let the turtles walk towards the door but don't give them any command of what to do when they are on the door. – LeirsW Mar 29 '22 at 09:56
  • In the text you wrote here, your first move procedure is clearly wrong but the second move procedure should work (although not necessarily for what you want it to do) – LeirsW Mar 29 '22 at 09:57
  • `target != nobody` checks if there is any patch in front of the turtle. As long as there is a patch in front of the turtle, it will keep turning around until there is no longer a patch in front of it, which won't happen. This is what causes your crash (always be careful with while loops). – LeirsW Mar 29 '22 at 09:58

0 Answers0