Reputation: 531
I would expect this code to create a triangle each time, but instead many times it goes through the wrap-around, creating a zigzag line or disconnected angle pieces. Why is that? Is it a bug?
Create a go button (not a forever button) to run this code
to go
clear-all
create-turtles 3
ask turtles
[ setxy random-xcor random-ycor
create-links-to (other turtles)]
end
Upvotes: 3
Views: 66
Reputation: 30453
The links take the shortest path, which may go around the world edges, which (in the default world topology) are connected to each other.
Go into the "Settings..." dialog and turn off wrapping if it isn't the behavior you wanted.
See http://ccl.northwestern.edu/netlogo/docs/programming.html#topology for details.
Upvotes: 3