user-defined turtle variables (also -own). Generate and characterize different breeds of agents using the breed functionality. example of declaring a new breed of agents. Specify agents-environment interactions through patch variable and. myself refers to the agent that is calling the current agent (it's probably the most confusingly named primitive in NetLogo).One problem is that your local variables pref-int and pref-att have the same name has the men-own variables.Women own to choose-mateīut netlogo doesn't seem to be able to access the variable values of women one I've referenced men with ask. It looks like you're using myself where you should be using self. However, of self is the same as some-variable, so you rarely use self. NetLogo automatically figures out who's variable you're referring to from the context. Set utiilty mans-pref-int * int + mans-pref-att * att So here are two ways to do what you're trying to do. Set utiilty ( of myself) * int + ( of myself) * att I prefer the myself version, but it's a matter of taste.Īlso, another observation. Its not a global attribute of a particular woman, but rather something specific to each man. to eat-weeds rabbit procedure gain 'weed-energy' by eating weeds if pcolor violet set pcolor black set energy energy + weed-energy end. Programming concepts: Agents, procedures, variables, ask, agentsets, breeds, synchronization. As such, I wouldn't recommend storing it as a woman-own variable. Turtles and patches use the wrapped distance (around the edges of the world) if wrapping is allowed by the topology and the wrapped distance is shorter.But I basically need something like: to take-money if turtle shape 'building institution' set money-held money-held + 1 end But I know that doesn't work. The distance to or a from a patch is measured from the center of the patch. How is the distance from a patch measured? ask turtles ] each turtle prints the turtle farthest from itself Take me to the full NetLogo Dictionary Turtles and patches use the wrapped distance (around the edges of the world) if wrapping is allowed by the topology and the wrapped distance is shorter. When do turtles use wrapped distance in NetLogo? (The patch variable begins with “p” so it doesn’t get confused with the turtle variable, since turtles have direct access to patch variables.) If you set the variable, the turtle or patch changes color. For example, all turtles and links have a color variable, and all patches have a pcolor variable. Is there a color variable for a link in NetLogo? When NetLogo starts up, min-pxcor, max-pxcor, min-pycor and max-pycor are -16, 16, -16, and 16 respectively. The total number of patches is determined by the settings min-pxcor, max-pxcor, min-pycor and max-pycor. Just like in the standard mathematical coordinate plane, pxcor increases as you move to the right and pycor increases as you move up. How is the total number of patches in NetLogo determined? We call the patch’s coordinates pxcorand pycor. The patch in the center of the world has coordinates (0, 0). (Patches can’t move, but otherwise they’re just as “alive” as turtles and the observer are.) Patches have coordinates. When NetLogo starts up, there are no turtles yet. (The coordinates are absolute coordinates they are not computed relative to this agent, as with patch-at.) If x and y are integers, the point is the center of a patch. Given the x and y coordinates of a point, reports the patch containing that point. Which is the center of a patch in NetLogo? This means that pxcorand pycorboth range from -17 to 17, so there are 35 times 35, or 1225 patches total. When NetLogo starts up, both screen-edge-xand screen-edge-yare 17. The total number of patches is determined by the settings screen-edge-xand screen-edge-y. Which is an example of a NetLogo command?Įxamples: ask n-of 10 patches ask 10 random patches to sprout 1 turtule ask turtle 0 ask turtle 0 to “hatch” a new turtle create-turtles 10 creates 10 turtles create-wolverines creates 10 turtles of breed wolverine note that you can immediately assign turtle characteristics and issue commands: How many pxcorand pycorboth are there in NetLogo? The first input defines the name of the agentset associated with the breed. Breed This keyword, like the globals, turtles-own, and patches-own keywords, can only be used at the beginning of the Code tab, before any procedure definitions.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |