title: How do I make turtles bounce off the world boundary in netlogo
body: <p>I have a box-bound world in Netlogo and my turtles are moving the way I want but some get stuck to the wall, which draws others in (I'm using the Flocking model as the backbone) until all turtles are stuck facing a wall and stop moving. I tried including a wall_jump in Go, but it doesn't help once there are too many flockmates up against the wall, so I put another block in to ask flockmates to bounce off the wall but it didn't seem to have any effect. If you want to recreate the entire issue, open the flocking model and close the world boundaries in.</p>
  
  <p>How have others solved this issue? </p>
  
  <pre><code> to wall_jump
    ifelse any? flockmates 
    [
     if ycor &gt;= max-pycor * 0.95  [set heading (random-normal 180 2)] 
     if xcor &gt;= max-pxcor * 0.95 [set heading (random-normal 270 2)]  
     if xcor &lt;= min-pxcor * 0.95   [set heading (random-normal 90 2)]          
     if ycor &lt;= min-pycor * 0.95   [set heading (random-normal 0 2)]           
    ]
  
    [if ycor &gt;= max-pycor * 0.95    [set heading (random-normal 180 2)] 
     if xcor &gt;= max-pxcor * 0.95   [set heading (random-normal 270 2)]  
     if xcor &lt;= min-pxcor * 0.95   [set heading (random-normal 90 2)]          
     if ycor &lt;= min-pycor * 0.95   [set heading (random-normal 0 2)]           
    ]
    end
  </code></pre>