Questions tagged [netlogo]

NetLogo is an agent-based programming language and integrated modeling environment. NetLogo is free and open source software, under a GPL license. Commercial licenses are also available. It is written in Scala and Java and runs on the Java Virtual Machine.

NetLogo is a multi-agent programmable modeling environment. It is used by tens of thousands of students, teachers and researchers worldwide. It also powers HubNet participatory simulations. It is authored by Uri Wilensky and developed at the CCL. It is free and open source.

4110 questions
5
votes
2 answers

NetLogo, weighted random draw from a list: how to use rnd-extension?

I have a list in NetLogo with values and a list of probabilities for each value. Now I want to draw a random value based on its probability (weighted random draw). I thought of using the Rnd extension, but I cant quite figure out how to get the…
Madelon
  • 95
  • 4
5
votes
1 answer

NetLogo - Setting a parameter to an Integer

Setting a function parameter to an integer in NetLogo After exhausting the Documentation for NetLogo online, I couldn't find a solution to set a parameter (lets call it r), to an integer in the function declaration. In python it is as simple as…
Paolo Bernasconi
  • 2,010
  • 11
  • 35
  • 54
5
votes
2 answers

Preventing a NetLogo turtle from hitting a wall

I'm trying to do something really simple, but for some reason I just can't get it to work. My setup function creates a square wall from (-20, 20) to (20, 20), and generates a circular turtle of size 3 inside the wall. The square wall is simply made…
Wakka02
  • 1,491
  • 4
  • 28
  • 44
5
votes
1 answer

turtle setup with even spacing in xcor and ycor

I want to setup turtles in NetLogo that are evenly distributed from min-xcor to max-xcor every 1 patch. Currently, what is clear is that turtles can be created with random-xcor and random-ycor. Please help.
5
votes
2 answers

Netlogo code problems, turtles can't find patch-at 0,0

I am trying to create a simulation along the same sort of lines as this video (1:29 - 1:45) https://www.youtube.com/watch?v=pqBSNAOsMDc I thought a simple way to achieve an infinite circling procress would be to make the turtles face 0,0, then look…
joehigh1
  • 193
  • 12
4
votes
3 answers

Learn the direction of a moving agent

I created a turtle in NetLogo which is moving randomly and there are some obstacles. Is it possible to get its current direction? I want to get the turtle to walk back to the center when it sees an obstacle. I can calculate distance to the center,…
Ecrin
  • 246
  • 5
  • 21
4
votes
3 answers

Supply argument to reporter

The following might be a basic programming question for Netlogo. I'd like to write generic reporters that I can supply arguments for what they should report on. Suppose the following program: turtles-own [ houses cars ] to setup clear-all …
Thomas K
  • 3,242
  • 15
  • 29
4
votes
0 answers

NetLogo database resultlist loading problem

I am trying to get some integer values from database (almost 30.000 rows) and it gives error "error while observer running READ-FROM-STRING in procedure GET-IMAGEDB Expected a constant." I considered it may happen because of requiring waiting time…
Ecrin
  • 246
  • 5
  • 21
4
votes
2 answers

Linking Netlogo and Python over Java Gateway

I was trying to connect Python and Netlogo over a java bridge using nl4py. I keep getting an error after trying everything like it is described here: https://arxiv.org/pdf/1808.03292.pdf . I am using MAC and python 2.7. I also tried doing it without…
SK4P3
  • 71
  • 7
4
votes
1 answer

NetLogo: foreach syntax

Very basic question, I can't see why my foreach code doesn't do anything (no error message but no effect whatsoever). So my turtles have a 3-dimensionnal variable (intention) that is preset to [0 0 0]. My final problem is much more complex than…
lomper
  • 379
  • 1
  • 12
4
votes
1 answer

NetLogo monitor widget display changes when nothing is happening

I have a NetLogo model, simplified to this: to setup clear-all create-turtles 1000 [ fd 100 ] end When I add a monitor widget to the UI, with a reporter like mean [xcor] of turtles and then run setup, the values in the monitor change a…
Jasper
  • 2,610
  • 14
  • 19
4
votes
2 answers

Netlogo & Levelspace: how to pass strings between two child-models?

I have three models: Parent, Child1, Child2. Child1 generates strings which must then be passed to Child2 for further processing. The strings are generated on the fly when Child1 is executing. Whenever a new string is generated it must be sent…
pnowack
  • 101
  • 6
4
votes
0 answers

random-poisson value for entire list in netlogo

I have agents called 'orders' Within these agents there is a number of devices as an attribute. Depending on the age of each of the devices, a certain number of devices will break in accordance with a random-poisson process. For example: Orders have…
DvB09
  • 41
  • 2
4
votes
0 answers

MOVE-TO expected input to be an agent but got NOBODY instead

What my code does is to set an internal grey patch zone and an external black patch zone, where turtles can multiply (one on each patch). Once a turtle reach the boundary between the gray and the black zones I assigned the variable energy to delay…
4
votes
1 answer

Netlogo count patches with neighbors of specific color

How can I code to know how many patches are in my world that have yellow neighbors? I'm using the following line: ask patches [ show count neighbors with [pcolor = yellow] ] The result is a long list of each patch answering the question, but all…
Javier Sandoval
  • 507
  • 3
  • 18