![]() The compiler knows “arity” (“valency”) about each procedure or function and does not require using the grouping again. True, functions of higher orders may be mistaken - then he needs a hint in the form of parentheses. Then you can write add add inc 1 inc 2 inc 3and get a well-deserved nine. It works the same way map inc which returns a list of. And for add you already have to write brackets ( map add )Īgents come in three forms - turtles (turtle - how can they be without them), communications (link) and spots (patch - they are places in space). Agents of the same type are combined into the corresponding set (agentset) - turtles, links and pathes.įor turtles and relationships, you can specify a user-defined breed. Representatives of the same breed are also combined into a set. A new breed is created by the team breed where ninja is the name of the breed, and ninjas is the name of the collection that brings together all the agents of this breed. There is also a special agent - the observer. The turtles are created with the create-turtles command (with the argument the number of turtles to be created), and then found by the turtle index function. The agent is “first class value” if desired, it can be stored in a variable, but this is rarely required.Īn agent or set of agents can be the context for a team. #Netlogo breeds codeĮxecuting commands in the context of agents is the main mechanism for working with them.Īsk turtles This code will ask all the turtles to take a step forward. Nl.path <- "C:/Program Files/NetLogo 6.0/app"Īg <- NLGetAgentSet(c("xcor","ycor"),"turtles")Īg2 <- data.The breed can be set dynamically ask turtle 1 #Netlogo breeds PatchĪsk patch 17 13 And this will paint the field with coordinates (17,13) in soft pink. The rows have to be sorted as NetLogo would process the agentset using the sort reporter. The columns of the ame have to be named exactly like theĪgent variable which should get the values. The agent variable values contained as columns in the input ame are changed. (optional) A string identifying a reference to a NetLogo instance created with NLStart. With a vector you can only set one agent variable at a time. If input is a simple vector instead of a ame it gives the name of the agent variable as a string which should be set with the values of the vector submitted in input. ![]() If a vector, only one agent variable can be set and the name has to be given by the optional argument var.name. The rows have to be sorted in the order NetLogo is processing the agentset with sort agentset (e.g. If a ame, it must have one column with the corresponding agent variable name for each agent variable to be set and one row for each agent. Usage NLSetAgentSet(agentset, input, var.name=NULL, nl.obj=NULL)Ī string specifying the agent or agentset for which values should be changed. NLSetAgentSet is an easy way to set the variable value(s) of one or more agent(s) (by specifying the name of the agent or the name of an agentset containing the agents) to the value(s) of a ame or vector. Sets a variable of one or more agent(s) to value(s) in a ame or vector.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |