1/31/2024 0 Comments Netlogo letEach type of agent has its own set of variables. You can also add your own variables to agents so that you can create custom states. Of course agents have variables and we have already been using many built in variables. Local variables only exist after the let statement and if the let is within square brackets it only exists within those brackets. You can also create a local variable within a function using the let keyword: You can define a global variable that is available to every function usingĪnd you can then use myVariable to store a value using set. The code, below: globals Īgain, you have a list and want to create a specific number of turtles for each combination of this list with the other lists.The last complication in getting to grips with NetLogo is the way variables work. Like for example: profile1: M1R1Ĭould anyone help me understand how I can solve this? The issue is that I get the following return: profile21: M1R1īut what I would like is to have this combination of metabolism and reproduction variables for each of the 31 profiles. For example: Perfil1 (turtles are only born in habitat 1): I would like to have exactly these nine combinations for the 31 turtle profiles. The problem is that I have 2 more variables (metabolism (M) and reproduction (R)), each with 3 levels: M1R1 ![]() For example: profile1: turtles are only born in habitat 1 I have 31 profiles of turtles that refer to combinations of 5 types of habitats. I tried to adjust how Lena responded and I couldn't, because I get stuck in the very similar problem that I still don't understand how to deal in the code. I have a problem that I asked for help here: How to make an equal distribution of turtles for each profile type using NetLogo 6.2?īut, I was not very precise in what I would like and it was partially solved. Set AvailablePatch other AvailablePatch this patch is no longer available Set UnassignedProfileCountList lput 9 UnassignedProfileCountList Set UnassignedProfileCountList effectively start from item 1 not zero ( pxcor mod ( n + 1 ) = 0 ) and ( pycor mod ( n + 1 ) = 0 ) ] Let n 2 20 meters away each turtle will be from another turtle code that should be run for every entry of ValidHabs Set all-code ( word code-metabolism code-reproduction ) (( item kkk UnassignedProfileCountList > 0 ) and ( true = member? habtype validhablist )) Print ( word "I am turtle:" " " who " " "my profile type:" " " turtle-profiles-habitat " " "my code:" " " all-code " " "my code reproduction level:" " " code-reproduction " " "my code metabolism level:" " " code-metabolism ) until you reach profile 31 where the turtles are born in habitats 1, 2, 3, 4 and 5: Perfil2 (turtles are only born in habitat 2): until you reach profile 31 where the turtles are born in habitats 1, 2, 3, 4 and 5 Profile6: turtles are only born in habitats 1 and 3 Profile6: turtles are only born in habitats 1 and 2 ![]() Profile5: turtles are only born in habitat 5 Profile4: turtles are only born in habitat 4 Profile3: turtles are only born in habitat 3 ![]() ![]() Profile2: turtles are only born in habitat 2
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |