Netlogo - Controlling specific sets of turtles - netlogo

I am trying to develop a model to demonstrate a field principle I am trying to work with. I am having trouble finding information on how to control specific groups of turtles. Essentially I would like to make a grid of turtles and links that I can distort, relative to an objective coordinate grid, based upon the placement of a different type of turtle, like a particle interacting with a field?
Any suggestions would be greatly appreciated. Is it possible to write a command that only talks to specific turtles by their who value? for instance if i had a coordinate plane that went from -3,3 in both x and y, rendering 49 vertices, could I set up those first 49 turtles, and then spawn my particle turtles (lets say 3), which would be who 49,50, and 51. could I write a command specifically for those 3 turtles based upon their relations to the first 49 turtles?
I hope this question makes sense.

Related

Netlogo - agent travels along the link

I am modelling another project concerning the warehouse operations. In this particular instance, I have to visualize the warehouse layout of the storage space. I plan to define a number of links as routes where the agents (forklift truck) can travel along with in the warehouse.
For each link, there is a distance associated with. It’s not the link length as the distance but a distance attributes user defined. If I set a forklift truck driving speed, how do I reflect it accurately in the model with the use of command like fd (or forward) and jump. How do I specify the unit of measure in jump or fd in association with the distance defined in the link to ensure the forklift truck is moving in a correct distance per tick given the speed and distance.
A simple demo would be highly appreciated! Great thanks!

Turtle Movement Netlogo

I have a network of turltes that each share two links. At the start of each turn the turtles decide to cooperate or defect, which updates a beta distribution of likelihood of cooperation in the next tick. If the turtles fail to cooperate over n turns they no longer interact. Through this I am able to create clusters in the cooperation network.
Right now, I am trying to figure out how to make the turtles move closer together proportional to the weight of their ties. Is there code to do this? I have only been able to find example code for patches.
I think this model might have something similar to what you want:
http://modelingcommons.org/browse/one_model/3632#model_tabs_browse_procedures

How do I make linked turtles move together in NetLogo?

I'm trying to model fish movement and need them to form schools when there is more than 1 of the breed in a given patch. So far I have managed to get them to form links when they encounter each other with the function below, but then they continue moving independently. I'd also like to re-scale the color of turtles in a linked group so that the more turtles in the group the darker the color is (I'm guessing this is similar to the way you make contour maps according to environmental gradients but I haven't figured it out yet).
Any assistance is always appreciated!
to form_link
if count breed_1-here > 1
[
ask breed_1
[create-links-with other breed_1-here]]
end
If linking isn't the way to get them to move together, I'm fine with another method.

Moving turtles from extension in NetLogo

I am working on creating a traffic grid in NetLogo. I would like to create an extension to go along with the model that contains the rules for updating the grid and moves the cars, turtles in this case, accordingly.
I am having trouble getting the turtles to actually move. The set of turtles is being passed as an argument to the function that should update the turtles' positions. I tried using setVariable(), but it isn't working for me:
Turtle car = args[0].getTurtle();
car.setVariable(AgentVariableNumbers.VAR_XCOR, 29);
car.setVariable(AgentVariableNumbers.VAR_YCOR, 40);
Since it is a traffic grid, I am focused on just moving the turtles forward for now. Is there a way (other than using setVariable) to move turtles from an extension?

Move to the opposite location of a detected turtle

I have an agent mouse and an agent cat.
When a mouse detects the presence of a cat around him, I want the mouse to rotate to the opposite positions where it detected the cat.
You can make one agent face another with face. You can then make the agent turn around with rt 180. The result will be that they're facing exactly away from the other agent!
When you have the option of multiple cats there might be a problem when running away from just one of them...
In that case you might want to make some weighted new direction, depending on the cats in the surroundings. But then your definition of the 'empty directions' and possible problems with multiple groups of cats coming in from different directions...
alternatively, you just move-to one-of neighbors with [count cats-here == 0]
(which will probably cause a run-time error if all neighbors harbour a cat.. :-)