To do a netlogo model with several patch layers (think floors of a building) do I need to go to Netlogo 3D? - netlogo

I have a netlogo application in mind which involves multiple non interacting layers. Think floors of a building. Would I need to go to netlogo 3D or is there a suggested way to handle in regular netlogo?

This was an interesting enough question that I decided to make a simple sample.
The method I use is to have a global variable to track the number-of-floors we'll have in our building, as well as the active-floor that we are currently working with. Then all our agents, walls and workers, have a floor-num that tracks which they are on. We have a set-active-floor procedure that handles switching our currently active floor that we want to see and work with, making the patches a certain color (active-color) if they have a wall agent present and swapping which workers are hidden?. In this way, most of the magic happens in the setup-floor and set-active-floor procedures, and the real work of our model in go can be pretty typical NetLogo code asking the active-workers to do whatever we want.
While the model is running you can call set-active-floor n to any value 0 to 4 to change the current workers and walls. I also included a show-all procedure that'll un-hide all the walls and workers and let you see where they are at; you'll need to run that with the model stopped.
globals [colors active-color number-of-floors active-floor]
turtles-own [floor-num]
breed [walls wall]
breed [workers worker]
to setup
clear-all
set colors (list red blue green orange violet)
set number-of-floors 5
foreach (range 0 number-of-floors) setup-floor
reset-ticks
set-active-floor 0
end
to setup-floor [num]
set active-floor num
set active-color (item num colors)
ask patches [ set pcolor black ]
; make some random walls
create-walls (count patches * 0.2) [
set floor-num num
set hidden? true
set size 0.5
setxy random-pxcor random-pycor
set pcolor active-color
]
; only one wall per patch
ask patches [
let patch-walls floor-walls-here
let wall-count count patch-walls
if (wall-count > 1) [
ask n-of (wall-count - 1) patch-walls [ die ]
]
]
; make some workes
create-workers 10 [
set floor-num num
set hidden? true
set shape "person"
set color active-color - 2
move-to one-of patches with [pcolor != active-color]
]
end
to go
; this only "runs" the active floor, but you could run all of them
; using the same `foreach (range 0 number-of-floors) ...` code as
; in the `setup` procedure.
set-active-floor active-floor
ask active-workers [
; this code can be about the same as you'd write in a normal model...
move-to one-of patches with [pcolor != active-color]
]
tick
end
to set-active-floor [num]
set active-floor num
set active-color (item num colors)
; after the `pcolor` is set, we can use that to determine if a wall
; exists or not for an `active-worker`, we don't have to check the
; floor number at all while we do our work.
ask walls [ set hidden? true ]
ask patches [
set pcolor ifelse-value no-walls-here [ black ] [ active-color ]
]
ask workers [
set hidden? floor-num != active-floor
]
end
to-report active-workers
report workers with [floor-num = active-floor]
end
to-report floor-walls-here
report walls-here with [floor-num = active-floor]
end
to-report no-walls-here
report (count floor-walls-here = 0)
end
to show-all
foreach (range 0 number-of-floors) [ num ->
ask patches [
set pcolor ifelse-value any? walls-here [ red - 3 ] [ black ]
]
ask turtles with [floor-num = num] [
set color item num colors
set hidden? false
]
]
end
Finally, if things got much more complicated than this, I would probably choose to move to NetLogo 3D instead.

Related

SEIS Disease Model Help in NetLogo - infected individuals do not become susceptible again?

I'm developing a simple NetLogo disease model that has 4 compartments:
S - susceptible individuals
E - Exposed individuals
I - Infected individuals
S - Recovered individuals that become susceptible again (i.e. there is no immunity).
My simulation starts off with 1 individual who is initially infected with the rest being susceptible.
This is the code I have so far:
turtles-own [
disease?
latent?
susceptible?
latent-period-time
infectious-period-time
]
to setup
clear-all
create-turtles num-agents [ setxy random-xcor random-ycor
set shape "wolf"
set size 2
become-susceptible
]
ask n-of infected-agents turtles [become-infected]
reset-ticks
end
to go
move
spread
tick
end
to move
ask turtles [
right random 50
left random 50
fd 1 ]
end
to spread
ask turtles [
ifelse disease? [] [
if any? other turtles-here with [ disease? ]
[ become-latent
set latent-period-time 0 ]
]]
ask turtles [
if latent-period-time = latent-period ;latent-period is a slider variable set to 30
[
become-infected
set infectious-period-time 0]
]
ask turtles [
if infectious-period-time = infectious-period ;infectious-period is a slider variable set to 100
[
become-susceptible]
]
ask turtles [
if latent?
[ set latent-period-time latent-period-time + 1 ]
if disease?
[set infectious-period-time infectious-period-time + 1] ]
end
to become-susceptible
set disease? false
set latent? false
set susceptible? true
set color orange
end
to become-latent
set latent? true
set disease? false
set susceptible? false
set color gray
end
to become-infected
set latent? false
set disease? true
set susceptible? false
set color blue
end
For some reason only the initial infected individual seems to go back to the susceptible pool, while any other newly infected individuals do not go back to the susceptible pool. The initially infected individual is also unable to get infected again after going back to the susceptible pool even though it encounters infected individuals.
I'm not sure how to fix this problem.
Thanks!
Your problem is that you never reset the value of latent-period-time and infectious-period-time back to 0. There are two ways to fix this:
Put the set to 0 into the same code that changes all the state flags and colours
Scrap the tracking and incrementing entirely and use a variable that records when the turtle gets to the state - assume it's called 'state-start-time' then you would simply have set state-start-time ticks and then do a subtraction for your test of duration.

Storing a value

A classroom is simulated where appliances (e.g lights Fans and ACs) turn on when a student sits next to it. Each appliance has its own wattage rating. When an appliance is turned on its color changes to green and the on-time is noted and the duration on-time is stored. But if a student sits next to a appliance (e.g light) that is already on. The duration-on-time should not be stored as it would be a repetition.
globals[
simulation-timer
to appliance-on
ask students [ ask lights in-radius 4
[ifelse not already-on?
[ set color green
set light-on-time ticks
set light-on-duration light-on-duration + (time - ticks)
show (word "light on duration = " light-on-duration)
set already-on? true] [
set light-on-duration light-on-duration]]]
In this code the light-on-duration is not adding for all of the lights. Only individual light-on-duration is shown. How should I fix this? Thank you!
I think you have a logic problem rather than a coding problem. You can't add to duration when the light turns on because it hasn't yet built up any duration. Here is a complete model that turns lights on and off and stores duration. I am using ticks as the time, and each tick it adds 5 students and removes 5 students. But what's important is the logic of turning the lights on and off.
globals [light-radius]
breed [students student]
students-own
[ desk
]
breed [lights light]
lights-own
[ on?
turned-on
duration-on
]
to setup
clear-all
set light-radius 3
ask patches [ set pcolor white ]
ask patches with [pxcor mod 3 = 0 and pycor mod 3 = 0]
[ sprout-lights 1
[ set size 0
set on? false
set pcolor gray
]
]
reset-ticks
ask n-of 30 patches
[ sprout-students 1
[ set color blue
]
ask lights in-radius light-radius [switch-light-on]
]
end
to go
repeat 5 [student-arrive]
repeat 5 [student-leave]
ask lights with [any? students in-radius light-radius]
[ switch-light-on
]
tick
end
to student-arrive
ask one-of patches with [not any? students-here]
[ sprout-students 1
[ set color blue
ask lights in-radius light-radius with [not on?]
[ switch-light-on
]
]
]
end
to switch-light-on
set pcolor yellow
set on? true
set turned-on ticks
end
to student-leave
ask one-of students
[ die
]
ask lights with [ on? and not any? students in-radius light-radius ]
[ switch-light-off
]
end
to switch-light-off
set pcolor gray
set on? false
type "previous duration: " print duration-on
let how-long ticks + 1 - turned-on
set duration-on duration-on + how-long
type "new duration: " print duration-on
end
Note that you can't actually see the light turtles, I am making the patch turn yellow for on and grey for off. Every third patch has a light.

"Can't use XXX in an observer context because patch only"

I am havig some diffuculties with a part of my code. Netlogo reort "Can't use GO in an observer context because patch only"
My guess is that this is because in the go part I ask for a procedure (CACULATEWILANDATRAC) that does not begin with "ask Patches". However the (CACULATEWILANDATRAC) produce is to calculate one of the patches own-variables, so ask patches does not seem fit here.
I still tried to solve it with putting ask patches before the procure but then
I get another error when running the model : " only the observer can ASK the set of all patches.
error while patch 1079 509 running ASK
called by (anonymous command: [ [the-Land-use the-Senario] -> ask patches [ if count patches with [ the-Land-use ] > the-Senario [ set Willingstochange True ] ] ]) called by procedure CACULATEWILANDATRAC"
The problem thus lies with where to call for the CACULATEWILANDATRAC procedure?
It is now part of the go procedure but this thus gives the error "Can't use XXX in an observer context because turtle only".
My entire code:
> extensions [gis]
globals
[
land-use-map
Senario1N ;; the count of patches senario 1 describes
Senario1L
Senario1A
Senario1B
Senario1I
Senario1R
Senario1W
%landusetypeN ;; the amount patches
%landusetypeL
%landusetypeA
%landusetypeB
%landusetypeI
Willingstochange ;; If true a patch would like to change (if true the count of patches has a surplus comparing to the sneario, if false they have a shortage)
atractiveness ;; if a patch type is attractive to change in <1 = yess
Atractiveneighbor
]
patches-own
[ Land-use ;; Wat kind og landusetype a patch has
]
to setup
clear-all
load-gis ;;load the maps
setup-constants
update-global-variables
update-display
reset-ticks
end
to load-gis ;;load the maps
set land-use-map gis:load-dataset "a_LANDUSE_cellsize5.asc" ;;loads the land use map
gis:set-world-envelope-ds gis:envelope-of land-use-map ;;sets the envelope of the world to match that of the GIS dataset
gis:apply-raster land-use-map Land-use ;;patches in the land-use-map have a specific land-use now
ask patches [
if Land-use = 1 [ set pcolor Green ] ; Green = Nature ;; patches have a certain color now
if Land-use = 2 [ set pcolor red ] ; Dark red = Leisure
if Land-use = 3 [ set pcolor Yellow ] ; Yellow = Agriculture
if Land-use = 4 [ set pcolor brown ] ; brouwn = Buildup
if Land-use = 5 [ set pcolor grey ] ; grey = roads
if Land-use = 6 [ set pcolor pink ] ; pink = industry
if Land-use = 7 [ set pcolor blue ] ; Blue = water
]
resize-world 0 1633 0 780
set-patch-size 1
end
to setup-constants
set Senario1N 49174 ;; the count of patches senario 1 describes
set Senario1L 17871
set Senario1A 569970
set Senario1B 34202
set Senario1I 5540
set Senario1R 34968
set Senario1W 65594
end
to go ;; this asks the model to caculate certain variables defined below
givecountlansusetypes
askforchange
caculateWILandAtrac
tick
end
to givecountlansusetypes ;; here the cuurent amount of patches is shown
show count patches with [Land-use = 1]
show count patches with [Land-use = 2]
show count patches with [Land-use = 3]
show count patches with [Land-use = 4]
show count patches with [Land-use = 5]
show count patches with [Land-use = 6]
show count patches with [Land-use = 7]
end
to update-display
ask patches
[
if Land-use = 1 [ set pcolor Green ] ;; Green = Nature ;; patches have a certain color now
if Land-use = 2 [ set pcolor red ] ;; Dark red = Leisure
if Land-use = 3 [ set pcolor yellow ] ;; Yellow = Agriculture
if Land-use = 4 [ set pcolor brown ] ;; brouwn = Buildup
if Land-use = 5 [ set pcolor grey ] ;; grey = roads
if Land-use = 6 [ set pcolor pink ] ;; pink = industry
if Land-use = 7 [ set pcolor blue ] ;; Blue = water
]
end
to update-global-variables
if count patches > 0
[ set %landusetypeN (count patches with [ Land-use = 1 ] / count patches) * 100
set %landusetypeL (count patches with [ Land-use = 2 ] / count patches) * 100
set %landusetypeA (count patches with [ Land-use = 3 ] / count patches) * 100
set %landusetypeB (count patches with [ Land-use = 4 ] / count patches) * 100
set %landusetypeI (count patches with [ Land-use = 6 ] / count patches) * 100
]
end
to caculateWILandAtrac
;; Sets Willingness to change true if patches are with more fellowpatches than the senario decribes
(foreach list (Land-use = 1) (Land-use = 2)[49174 17871]
[ [the-Land-use the-Senario] -> ask patches [if count patches with [the-Land-use] > the-Senario [ set Willingstochange True ] ] ])
;; gives score to the patches attractiveness based on the ratio patches/senario
(foreach list (Land-use = 1) (Land-use = 2)[49174 17871]
[ [the-Land-use the-Senario] -> ask patches [ set atractiveness (count patches with [the-Land-use]/ the-Senario) ] ])
end
to askforchange
ask patches [
if Willingstochange = true [change] ;; this ask the patches that are willing to change (have a surpuls) to go and change
]
end
to change
ask neighbors with [Willingstochange = false ] ;; this asks if the patch had neigbors with a shortage
[set Atractiveneighbor min-one-of patches [atractiveness]] ;; this asks to give the neigbor with the lowest patchcount/senario ratio
ask patches [set Land-use ([Land-use] of Atractiveneighbor)] ;; this asks the patches to change their land-use to the land-use of neigbor with the lowest patchcount/senario ratio
end
In your last line of code the current asked patch (asked in askforchange) asks all patches to set their Land-use accordingly. I think that there lies your problem.
Maybe it solves your problem, if you replace the last line with the following:
set Land-use ([Land-use] of Atractiveneighbor)
With this, the currently asked patch changes its land-use accordingly. But I am not quite sure, if that is what you want the procedure to do there?

Netlogo, how to delete link between turtles based on value they own

I am writing simulation where i am trying to simlate recruiting process for terrorost organization. In this model turtles have groups of friends i.e other turtles they are connected to with links. The model includes the forming of new bonds(links) with turtles they meet if their world view is similar and is supposed to have a mechanism for disconectiong from friends with world view most different from them among their friends.
Tried to solve the issue with following block of code which does not seem to work properly, often get the error message
"OF expected input to be a turtle agentset or turtle but got NOBODY instead."
related to value of friend_dif
ask turtles with [(connections > 0) and (color = blue)][
let friends_inverse ( 1 / connections )
if friends_inverse > random-float 1[
let friend_dif abs([world_view] of self - [world_view] of one-of other link-neighbors)
ask max-one-of links [friend_dif][
die
]
]
set connections count link-neighbors
]
Below is the whole code for the mentioned simulation. The aim is to comparetwo strategies one where recriters focus on turtles with most radical world view, the second where they first targets the most central turtles in the net.
turtles-own [connections world_view]
to setup
ca
crt potential_recruits [setxy random-xcor random-ycor set color blue]
ask turtles with [color = blue][
let przypisania random max_start_recruits_connections
;; 0-0.4 non interested, 0.4-0.7 moderate, 0.7-0.9 symphatizing, >0.9 radical - can be recrouted
set world_view random-float 1
if count my-links < 10 [
repeat przypisania [
create-link-with one-of other turtles with [(count link-neighbors < 10) and (color = blue)]
]
]
show link-neighbors
set connections count link-neighbors
]
crt recruiters [setxy random-xcor random-ycor set color orange]
ask turtles with [color = orange][
set world_view 1
if strategy = "world view"[
recruit_view
]
if strategy = "most central"[
recruit_central
]
]
;;show count links
reset-ticks
setup-plots
update-plots
end
to go
;;creating new links with turtles they meet and movement which is random
ask turtles [
rt random-float 360
fd 1
if any? other turtles-here[
let world_view1 [world_view] of one-of turtles-here
let world_view2 [world_view] of one-of other turtles-here
let connection_chance abs(world_view1 - world_view2)
if connection_chance <= 0.2 [
;;show connection_chance
create-links-with other turtles-here
]
]
;;show link-neighbors
set connections count link-neighbors
]
;;how recruiting works in this model
ask turtles with [world_view > 0.9][
if count in-link-neighbors with [color = orange] > 0[
set color orange
set world_view 1
]
]
;; friend's influence on turtles
ask turtles with [(count link-neighbors > 0) and (color = blue)][
let friends_view (sum [world_view] of link-neighbors / count link-neighbors)
let view_dev (friends_view - world_view)
;;show world_view show view_dev
set world_view world_view + (view_dev / 2)
]
;; removing turtles from with most different opinion from our colleagues
ask turtles with [(connections > 0) and (color = blue)][
let friends_inverse ( 1 / connections )
if friends_inverse > random-float 1[
let friend_dif abs([world_view] of self - [world_view] of one-of other link-neighbors)
ask max-one-of links [friend_dif][
die
]
]
set connections count link-neighbors
]
;show count links
tick
update-plots
end
to recruit_view
ask max-n-of start_recruiters_connections turtles with [ color = blue][world_view][
repeat start_recruiters_connections[
create-link-with one-of other turtles with [ color = orange]
]
]
ask turtles with [color = orange][
set connections count link-neighbors
]
end
to recruit_central
ask max-n-of start_recruiters_connections turtles with [ color = blue][count my-links][
repeat start_recruiters_connections[
create-link-with one-of other turtles with [ color = orange]
]
]
ask turtles with [color = orange][
set connections count link-neighbors
]
end
to batch
repeat 50 [
go
]
end
Your problem is that you aren't switching contexts (that is, whether the code is 'currently' in the perspective of a turtle or a link) correctly.
You start with ask turtles - pretend you are now the first turtle being asked. First a value is calculated and then compared to a random number - assume that the if is satisfied. The code is still in the turtle context, so the code inside the [] is applied to this first turtle.
The code creates a variable called friend_dif and assigns its value as the difference in worldviews between itself and one randomly selected network neighbours. In your code, you then have max-one-of links [friend_dif]. However, that only selects the link with the maximum value of friend_dif if (1) friend_dif is a links-own attribute and (2) the value of friend_dif has been set for all links. Neither is true. Furthermore, by asking for max-one-of links [friend_dif], you are asking for the link with the highest value from all links in the model, not just the ones with the turtle of interest at one end.
So you need to get your turtle to calculate the difference for all its link-neighbors and then switch contexts to the link that connects the two turtles, before asking that link to die.
This is not tested. What it is supposed to do is identify the network neighbour that returns the biggest difference in worldview values and then use the name of the link (which is given by the two ends) to ask it to die.
ask turtles with [ count my-links > 0 and color = blue]
[ if random-float 1 < 1 / count my-links
[ let bigdif max-one-of link-neighbours [abs ([worldview] - [worldview] of myself)
ask link self bigdif [die]
]
]
Alternatively (and easier to read), you can create a link attribute that stores the value of the differences in worldviews (called dif below), then do something like:
ask links [ set dif abs ([worldview] of end1 - [worldview] of end2) ]
ask turtles with [ count my-links > 0 and color = blue]
[ if random-float 1 < 1 / count my-links
[ ask max-one-of my-links [dif] [die]
]
]

Subtract. SET variableX-variableY only once

I'm trying to set a resource variable. It will be time and will function like sugar in sugarscape. Its setup is: ask agentes [set time random-in-range 1 6].
The thing is... I want the agentesto participate in activities linking like we said here. But, with each participation, it should subtract a unity of agentes's time. I imagine it must be with foreachbut I seem to be unable to grasp how this works.
ask n-of n-to-link agentes with [n-t-activity = [n-t-activity] of myself] in-radius sight-radius [
while [time >= 2] [
create-participation-with myself [ set color [color] of myself ] ]
foreach (command I don't know)[
set time time - count participations]]
Essentially, I want the agentes to look if they have time to participate. If they do, they create the link and subtract 1 to their time. Only ONE per participation. If they have 3 time, they'll have 2 participations and 1 time. If they have 1 time, they won't have links at all.
EDIT
You're right. I don't need while. About foreach, every place I looked said the same thing but I can't think of other way. About colors, they're only for show purpose.
The relationship between time and participation counts is as follows: the agentes have time they can spend in activities. They participate if time>=2. But every participation (link with activity) consumes 1 time when the link is active (I didn't write the decay code yet; they'll regain their time when it is off).
EDIT V2
Nothing, it keeps subtracting even with the []. Maybe the best choice is if I give you the code so you can try it. You'll have to set 5 sliders: prob-female (53%), initial-people (around 200), num-activity (around 20), n-capacity (around 25) and sight-radius (around 7). And two buttons, setup and go. I also set a patch size of 10 with 30 max-pxcor and max-pycor. Here is the code. Sorry if I'm not clear enough!
undirected-link-breed [participations participation]
turtles-own [
n-t-activity
]
breed [activities activity]
activities-own [
t-culture-tags
shared-culture
]
breed [agentes agente]
agentes-own [
gender
time
culture-tags
shared-culture
]
to setup
clear-all
setup-world
setup-people-quotes
setup-activities
reset-ticks
END
to setup-world
ask patches [set pcolor white]
END
to setup-people-quotes
let quote (prob-female / 100 * initial-people)
create-agentes initial-people
[ while [any? other turtles-here ]
[ setxy random-xcor random-ycor ]
set gender "male" set color black
]
ask n-of quote agentes
[ set gender "female" set color blue
]
ask agentes [
set culture-tags n-values 11 [random 2]
set shared-culture (filter [ i -> i = 0 ] culture-tags)
]
ask agentes [
set time random-in-range 1 6
]
ask agentes [
assign-n-t-activity
]
END
to setup-activities
create-activities num-activity [
set shape "box"
set size 2
set xcor random-xcor
set ycor random-ycor
ask activities [
set t-culture-tags n-values 11 [random 2]
set shared-culture (filter [i -> i = 0] t-culture-tags)
]
ask activities [
assign-n-t-activity]
]
END
to assign-n-t-activity
if length shared-culture <= 4 [
set n-t-activity ["red"]
set color red
]
if length shared-culture = 5 [
set n-t-activity ["green"]
set color green
]
if length shared-culture = 6 [
set n-t-activity ["green"]
set color green
]
if length shared-culture >= 7 [
set n-t-activity ["black"]
set color black
]
END
to go
move-agentes
participate
tick
end
to move-agentes
ask agentes [
if time >= 2 [
rt random 40
lt random 40
fd 0.3
]
]
end
to participate
ask activities [
if count my-links < n-capacity [
let n-to-link ( n-capacity - count my-links)
let n-agentes-in-radius count (
agentes with [
n-t-activity = [n-t-activity] of myself ] in-radius sight-radius)
if n-agentes-in-radius < n-to-link [
set n-to-link n-agentes-in-radius
]
ask n-of n-to-link agentes with [
n-t-activity = [n-t-activity] of myself] in-radius sight-radius [
if time >= 2 [
create-participation-with myself [
set color [color] of myself ]
ask agentes [set time time - count my-participations] ]
]
ask activities [
if not any? agentes in-radius sight-radius [
ask participations [die]
]
]
]
]
end
to-report random-in-range [low high]
report low + random (high - low + 1)
END
EDIT V3
I asked Bill Rand to help me and he solved the problem. The issue was in this line: let candidates agentes with [ n-t-activity = [n-t-activity] of myself ] in-radius sight-radius. He solved the problem this way: let candidates agentes with [ n-t-activity = [n-t-activity] of myself and not participation-neighbor? myself ] in-radius sight-radius. Being this and not participation-neighbor? myself the condition to make sure that the agente is not already a part of that activity.
You almost never need foreach in NetLogo. If you find yourself thinking you need foreach, your immediate reaction should be that you need ask. In particular, if you are iterating through a group of agents, this is what ask does and you should only be using foreach when you need to iterate through a list (and that list should be something other than agents). Looking at your code, you probably don't want the while loop either.
UPDATED FOR COMMENTS and code - you definitely do not need while or foreach.
Your problem is the following code. You ask agentes that satisfy your conditions to create the links, but then you ask ALL AGENTES to change their time (line I have marked), not just the agentes that are creating participation links.
ask n-of n-to-link agentes with [
n-t-activity = [n-t-activity] of myself] in-radius sight-radius [
if time >= 2 [
create-participation-with myself [
set color [color] of myself ]
ask agentes [set time time - count my-participations] ] ; THIS LINE
]
The following code fixes this problem. I have also done something else to simplify reading and also make the code more efficient - I created an agentset (called candidates) of the agentes that satisfy the conditions. In this code, the candidates set is only created once (for each activity) instead of twice (for each activity) because you are creating it to count it and then creating it again to use for participation link generation.
to participate
ask activities
[ if count my-links < n-capacity
[ let candidates agentes with [
n-t-activity = [n-t-activity] of myself ] in-radius sight-radius
let n-to-link min (list (n-capacity - count my-links) (count candidates ) )
ask n-of n-to-link candidates
[ if time >= 2
[ create-participation-with myself [ set color [color] of myself ]
set time time - count my-participations ] ; REPLACED WITH THIS LINE
]
ask activities [
if not any? agentes in-radius sight-radius [
ask participations [die]
]
]
]
]
end