netlogo

NetLogo : How to make sure a variable stays in a defined range?

大兔子大兔子 提交于 2019-11-29 04:48:12
I have a few variables which can be inherited to child agents by a variation of + 0.1 and -0.1 or without any changes, or random again, What I have done is like this: (The code is just an example) to reproduce ask turtle 1 [ let X-Of-Mother X hatch 1 [ set X one-of (list (X-Of-Mother) (X-Of-Mother + 0.1) (X-Of-Mother - 0.1) (random-float 1)) ] ] end Currently I have to check if X of child turtle is always within range by something like this: if X > 1 [set X X - 0.2] if X < 0 [set X X + 0.2] What could be a better way to do it? What if I have to use random-normal 0.5 0.1 , how can I limit that

Adding patch clusters in a landscape

落花浮王杯 提交于 2019-11-28 14:17:49
I would like to add forest patches in a landscape. To be more precise, the idea is to add patch clusters like "Patch Clusters" example. Contrary to this example, I want to randomly distribute some patch clusters with the same color and not several clusters that fill entirely the landscape. This is a beginning of code : to create-forests repeat 30 [ ask one-of patches [ set pcolor green ask neighbors [ set pcolor green] ] ] end With this code, the clusters look like squares and not clusters like "Patch Clusters" example. How can I add forest patch clusters in my landscape ? Thank you for your

How can one create a countdown timer in NetLogo?

ぐ巨炮叔叔 提交于 2019-11-28 14:13:55
I am trying to make a Frogger-like game in NetLogo and I need to create a timer that counts down. However, I looked in Frogger and used the same procedures that create the timer but it does not work. Please advise. How to create a count-down timer in NetLogo This is a general outline of how to implement a count-down timer. This applies both to a real-time count-down, or a simulation-time count-down. Implement a variable to contain the remaining time or elapsed time. The variable is usually a global variable, unless each agent must have its own count-down. Then the variable will be a -own'd

Creating a random shape (blob) of a given area in NetLogo

强颜欢笑 提交于 2019-11-28 11:26:34
Is it possible to create random shapes (see below for example) of a given area in NetLogo? A first stab at Seth's suggestion #1. It creates a neat visual too! patches-own [ height ] to blobbify clear-all repeat (ceiling 2 * (ln (world-height * world-width))) [ ask patch (round (random (world-width / 2)) - world-width / 4) (round (random (world-height / 2)) - world-height / 4) [ set height world-width * world-height ] ] while [ count patches with [ height > 1 ] < (world-width * world-height / 4)] [ diffuse height 1 ask patches with [ height > 0 ] [ set pcolor height ] ] ask patches with [

Reading an Excel .txt file with both text and numbers into NetLogo

核能气质少年 提交于 2019-11-28 08:54:07
问题 I have a file prepared in Excel that contans both text and numbers e.g line 1 would have MyAge 20 MyYear 1994. I save it as a .txt (text tab delimited) file and attempt to read it into Netlogo. When I open the file in Notepad, the numbers show as numbers and the text show with "". Netlogo does nto read the file saying "expecting a constant". If I remove the text or manually surround the text with quotes, then it works fine. So if my line read: "MyAge" 20 "MyYear" 1994, it owkrs ifne. It would

NetLogo R Extension Installation Error in Mac OS X Yosemite

寵の児 提交于 2019-11-28 06:15:06
问题 I am having problems installing the R extension for NetLogo. I'm using NetLogo 5.05 and version 1.3 of the extension, which is supposed to work with R version 3.0 or higher. My version of R is 3.1.2. Following the instructions from this page, I have changed the .plist file within the NetLogo app so that it points to jri and to my R installation: <key>NSJavaRoot</key> <string>..</string> <key>LSEnvironment</key> <dict> <key>JRI_HOME</key> <string>/Library/Frameworks/R.framework/Resources

How to model a very large world in NetLogo?

独自空忆成欢 提交于 2019-11-28 02:10:01
问题 I need to create a very large grid of patches to have GIS information of a very large network (such as a city-wide network). My question is how to get NetLogo to model such a world? When I set the max-pxcor and max-pycor to large numbers, it stop working. I need a world of for example size 50000 * 50000. Thanks for your help. 回答1: See http://ccl.northwestern.edu/netlogo/docs/faq.html#howbig , which says in part: “The NetLogo engine has no fixed limits on size...” It's highly unlikely that you

NetLogo Efficient way to create fixed number of links

萝らか妹 提交于 2019-11-28 01:28:20
I have about 5000 agents (people) in my model. I want to give them an arbitrary number of friends and have reciprocal but random pairing. So if person A chooses person B then person B also chooses person A. My code works fine, but is fairly slow. I will likely want to increase both the number of friends and the number of people in the future. Any quicker suggestions? ask people [ let new-links friends - count my-links if new-links > 0 [ let candidates other people with [ count my-links < friends ] create-links-with n-of min (list new-links count candidates) candidates [ hide-link ] ] ] Note

NetLogo : How to make sure a variable stays in a defined range?

微笑、不失礼 提交于 2019-11-27 18:44:04
问题 I have a few variables which can be inherited to child agents by a variation of + 0.1 and -0.1 or without any changes, or random again, What I have done is like this: (The code is just an example) to reproduce ask turtle 1 [ let X-Of-Mother X hatch 1 [ set X one-of (list (X-Of-Mother) (X-Of-Mother + 0.1) (X-Of-Mother - 0.1) (random-float 1)) ] ] end Currently I have to check if X of child turtle is always within range by something like this: if X > 1 [set X X - 0.2] if X < 0 [set X X + 0.2]

How can one create a countdown timer in NetLogo?

家住魔仙堡 提交于 2019-11-27 08:11:48
问题 I am trying to make a Frogger-like game in NetLogo and I need to create a timer that counts down. However, I looked in Frogger and used the same procedures that create the timer but it does not work. Please advise. 回答1: How to create a count-down timer in NetLogo This is a general outline of how to implement a count-down timer. This applies both to a real-time count-down, or a simulation-time count-down. Implement a variable to contain the remaining time or elapsed time. The variable is