![]() ![]() Ifelse any? other turtles-on patches in-cone 1.5 60 set food random 10 crt 2 set memory-map table:make reset-ticks end to go if. #Netlogo crt PatchIf spawnpoint = 3 [ move-to one-of walkway with [not any? turtles-here and (pycor 0.01 netlogo - Memory: storing patch variables in table for multiple patches. (pxcor 3 and pycor -4 and pxcor -4 and pycor 11)]] Netlogo - Creating chargingpoles after specific time #Netlogo crt how toNetlogo - How to specify the number of seconds a patch will record data about turtle flow? Netlogo - List all potential paths between linked turtles Netlogo - How to kill of all turtles except for one? Netlogo - turtles overshooting their target and getting stuck in infinite movement loop Table:put memory-map ( of patch-here) food Set pcolor red for visualization purposes Set food (food * 0.5) representing consumption in the current patch Show memory-map check what table looks like Set memory-map patch-memmap return the new table to the turtle Set pcolor green for visualization purposes Let patch-memmap memory-map so that patches can access the table, otherwise it's only accessible to turtles and it gives an error #Netlogo crt updateLoop asking each of the neighbors to update the table Table:put memory-map ( of patch-here) food Add key (id) and value (food) of current patch to the table Set memory-map table:make Create empty table Set pcolor yellow for visualization purposes (foreach (sort patches) (n-values (count patches) ) -> ask i ]) (that way you only deal with one value instead of a set of coordinates) Assign a specific ID to each patch to act as the key for the table netlogo - Memory: storing patch variables in table for multiple patches In the end, I need a table with keys containing (pxcor pycor year) of each neighbouring patch and the food value as the value of each key. Which works but I can't figure out how to use each set of list inputs as a key for the table. I have also tried creating a list of coordinates/year for all neighbors first: let thispatch of neighbors ![]() This last bit gives me an error that suggest table:put can only be used in turtle context. Now, I tried to modify this code using foreach to loop through neighbors and get the set-memory procedure to work for each patch: to set-memory Let thispatch (list pxcor pycor year) key for table to one-turtle crt 1 set color green setxy min-pxcor 0 set heading 90 end to go ask (turtles-on patch min-pxcor 0) if create true one-turtle end. I want to get some advice in this sample case. The code that seems to be working for the current patch is: extensions The following codes is sample one but it's not work well because of it's in a turtle context. I have managed to code for the creation of a table that has these values for the current patch but am stuck trying to scale this so that, at each time step, the turtle stores these three things for all its neighboring patches. I am creating turtle-specific tables in which to store patch coordinates, year of simulation (global variable set to 1, 2, or 3 depending on tick count), and a patch variable representing available resources. Later, we can make the males and females behave differently: the males will walk around more drunkenly than the females. Netlogo - Memory: storing patch variables in table for multiple patches - netlogo - Memory: storing patch variables in table for multiple patches ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |