Closed bennlich closed 3 years ago
This is due to our deciding early on not to have a torus geometry.
NetLogo sez:
patch-at-heading-and-distance reports the single patch that is the given distance from this turtle or patch, along the given absolute heading. (In contrast to patch-left-and-ahead and patch-right-and-ahead, this turtle's current heading is not taken into account.) Reports nobody if the patch does not exist because it is outside the world.
And:
patch-left-and-ahead angle distance patch-right-and-ahead angle distance Reports the single patch that is the given distance from this turtle, in the direction turned left or right the given angle (in degrees) from the turtle's current heading. Reports nobody if the patch does not exist because it is outside the world.
For turtles, there is an edge handler which will wrap, bounce, clamp or simply take a modeler provided function.
Maybe we could somehow use the same approach for patches? It would be non-trivial tho.
I'm closing this, the api seems reasonable if netlogo feels that wrapping etc is not the right solution. Turtles have that behavior, however, and could be used instead.
As I was working on an agentscript model based on netlogo's slime, I noticed that the
patchAhead
functions do not wrap, so you have to write code like:Or, from AntsModel:
I think it would make life easier for new modelers if they didn't have to think about that.
I also noticed that
patches.diffuse()
does not wrap either. I think it would be more correct if it did (if the world wraps sometimes, it should wrap all the time).My 6th sense tells me this is a conversation that happened long ago and I am arriving late... I hope it's not a can o' worms :-P
Model pebble: