How to avoid nobody run time error in netlogo?run time error for list in netlogoTime for a procedure to run in NetLogoRun-time error in NetLogo, turtles trying to turn 'towards' but get NOBODY insteadNetLogo: Changing one breed's variable depending on other breed's variable in an ego-centric network environmentHow to ask turtles to avoid a patch with specific color at patch-ahead 1 but turtles move forward by bigger number (not fd 1) in one step in NetLogoNetlogo How to avoid NOBODY Runtime error?How to re-run a Netlogo run?Netlogo Web run time errorNetLogo: How to make a turtle recognise any shade of one color?Netlogo: reporter keeps changing

Methods and Feasibility of Antimatter Mining?

The pirate treasure of Leatherback Atoll

What makes things real?

Write a Schrödinger's sentence

Distinguishing between octahedral and tetrahedral holes

What's the biggest difference between these two photos?

Is there a specific way to describe over-grown, old, tough vegetables?

What makes an ending "happy"?

The Green Glass Door, Revisited

Problem with listing a directory to grep

Remove outer padding in tikzcd

Why is it that I have to play this note on the piano as A sharp?

Can multiple public keys lead to the same shared secret in x25519?

How do you say "to hell with everything" in French?

How do Scrum teams manage their dependencies on other teams?

UK citizen travelling to France at the end of November

Supervisor wants me to support a diploma-thesis software tool after I graduated

Do you need to burn fuel between gravity assists?

How do we create our own symbolisms?

When did computers stop checking memory on boot?

Bacteria vats to generate edible biomass, require intermediary species?

Is there any control character or hack to prevent simple command line tools from showing subsequent data?

Python implementation of atoi

How strong is aircraft-grade spruce?



How to avoid nobody run time error in netlogo?


run time error for list in netlogoTime for a procedure to run in NetLogoRun-time error in NetLogo, turtles trying to turn 'towards' but get NOBODY insteadNetLogo: Changing one breed's variable depending on other breed's variable in an ego-centric network environmentHow to ask turtles to avoid a patch with specific color at patch-ahead 1 but turtles move forward by bigger number (not fd 1) in one step in NetLogoNetlogo How to avoid NOBODY Runtime error?How to re-run a Netlogo run?Netlogo Web run time errorNetLogo: How to make a turtle recognise any shade of one color?Netlogo: reporter keeps changing






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I'm checking the interaction among the properties of three types of patches by using 'one-of neighbors' command. Problem occurs when the two patches are not neighboring to each other in some cases and entity NOBODY emerges. Is there any way to avoid this. It is necessary for me to use 'one-of neighbors' command. Can I give a command stating that if Nobody is detected then the value of the property of that patch be 0.1. In my code give below the problem occurs in the interaction b/w yellow patch and red patch as in some places red is not a neighbor of yellow.



I tried writing a Nobody command it was not correct.I appreciate your advice.



globals [ k ] ; interaction constant
patches-own [ a b c d' e' eeep deep ] ; state variables of properties
; a is the Proportion and variety of Blend of land
use
; b is the Land uses with supportiveness for
complimentary activities
; c is the Vehicular and Pedestrian Intensity
; d is the Intensity of Nodes in urban web
; e' is the Frequency of Enforced Vigilance
to setup
clear-all
set k initial-k
setup-patches
reset-ticks
end
to setup-patches
ask patches [ set pcolor yellow ] ; defines the patches as built up in an area

; to define yellow patches without a and b
ask patches [ if (pycor > 1) and (pycor < 8) and (pxcor = -3 ) [ set pcolor 46 ] ]
ask patches [ if (pycor > 1) and (pycor < 8) and (pxcor = -2 ) [ set pcolor 46 ] ]
ask patches [ if (pycor < -1) and (pxcor = -10 ) [ set pcolor 46 ] ]
ask patches [ if (pycor < -1) and (pxcor = -9 ) [ set pcolor 46 ] ]
ask patches [ if (pycor < -1) and (pxcor = -5 ) [ set pcolor 46 ] ]
ask patches [ if (pycor < -1) and (pxcor = 2 ) [ set pcolor 46 ] ]
ask patches [ if (pycor < -2) and (pxcor = 6 ) [ set pcolor 46 ] ]
ask patches [ if (pycor > 1) and (pycor < 8) and (pxcor = 2 ) [ set pcolor 46 ] ]
ask patches [ if (pycor = 2) and (pxcor > 8 ) [ set pcolor 46 ] ]
ask patches [ if (pycor = -2) and (pxcor > 2 ) [ set pcolor 46 ] ]
ask patches [ if (pycor = -3) and (pxcor > 6 ) [ set pcolor 46 ] ]
ask patches [ if (pycor = -4) and (pxcor > 6 ) [ set pcolor 46 ] ]
ask patches [ if (pycor = -8) and (pxcor > 6 ) [ set pcolor 46 ] ]
ask patches [ if (pycor = -9) and (pxcor > 6 ) [ set pcolor 46 ] ]
ask patches [ if (pycor = 7) and (pxcor > 8 ) [ set pcolor 46 ] ]
ask patches [ if (pycor = 6) and (pxcor > 8 ) [ set pcolor 46 ] ]
ask patches [ if (pycor = 2) and (pxcor > 2 ) and (pxcor < 6) [ set pcolor 46 ] ]

; to define road patches (horizontal)
ask patches [ if pycor = 0 [ set pcolor grey ] ]
ask patches [ if pxcor = 0 [ set pcolor grey ] ]
ask patches [if pycor = 9 [ set pcolor grey ] ]
ask patches [ if (pycor = 6) and (pxcor < -4 )[ set pcolor grey ] ]
ask patches [ if (pycor = 3) and (pxcor < -4 ) [ set pcolor grey ] ]
ask patches [ if (pycor = 4) and (pxcor > 3 ) [ set pcolor grey ] ]
ask patches [ if (pycor = -6) and (pxcor > 7 ) [ set pcolor grey ] ]

; to define road patches (vertical)
ask patches [ if (pycor > 0) and (pxcor = -10 ) [ set pcolor grey ] ]
ask patches [ if (pycor > 0) and (pxcor = -5 ) [ set pcolor grey ] ]
ask patches [ if (pycor < 0) and (pxcor = -7 ) [ set pcolor grey ] ]
ask patches [ if (pycor < 0) and (pxcor = -3 ) [ set pcolor grey ] ]
ask patches [ if (pycor < -3) and (pxcor = 4 ) [ set pcolor grey ] ]
ask patches [ if (pycor > 3) and (pxcor = 4 ) [ set pcolor grey ] ]
ask patches [ if (pycor > 0) and (pxcor = 7 ) [ set pcolor grey ] ]

; to define nodes as patches
ask patches [ if pxcor = 0 and pycor = 0 [ set pcolor red ] ]
ask patches [ if pxcor = 7 and pycor = 0 [ set pcolor red ] ]
ask patches [ if pxcor = -3 and pycor = 0 [ set pcolor red ] ]
ask patches [ if pxcor = -5 and pycor = 0 [ set pcolor red ] ]
ask patches [ if pxcor = -7 and pycor = 0 [ set pcolor red ] ]
ask patches [ if pxcor = -10 and pycor = 0 [ set pcolor red ] ]
ask patches [ if pxcor = 4 and pycor = 4 [ set pcolor red ] ]
ask patches [ if pxcor = 7 and pycor = 4 [ set pcolor red ] ]
ask patches [ if pxcor = 7 and pycor = 9 [ set pcolor red ] ]
ask patches [ if pxcor = 4 and pycor = 9 [ set pcolor red ] ]
ask patches [ if pxcor = 0 and pycor = 9 [ set pcolor red ] ]
ask patches [ if pxcor = -5 and pycor = 9 [ set pcolor red ] ]
ask patches [ if pxcor = -10 and pycor = 9 [ set pcolor red ] ]
ask patches [ if pxcor = -10 and pycor = 6 [ set pcolor red ] ]
ask patches [ if pxcor = -10 and pycor = 3 [ set pcolor red ] ]
ask patches [ if pxcor = -5 and pycor = 6 [ set pcolor red ] ]
ask patches [ if pxcor = -5 and pycor = 3 [ set pcolor red ] ]

; to set intial values of properties for patches
ask patches with [pcolor = yellow] [ set a random-float 0.9] ; initial a
ask patches with [pcolor = yellow] [ set b random-float 0.9] ; initial b
ask patches with [pcolor = grey] [ set c random-float 0.9] ; initial c
ask patches with [pcolor = red] [ set d' random-float 0.9] ; initial d'
ask patches with [pcolor = grey] [ set e' random-float 0.9] ; initial e'
end
to go
tick
if ticks >= 52 [ stop ]
ask patches with [pcolor = yellow]
[
let fc [c] of one-of neighbors with [pcolor = grey] ; reports c of any
one grey patch of neighbours
let fe' [e'] of one-of neighbors with [pcolor = grey] ; reports e' of any one grey patch of neighbours
let fd' [d'] of one-of neighbors with [pcolor = red]; reports d' of any one red patch of neighbours
if a < 0.1 [ set a 0.1
if a > 0.9 [ set a 0.9 ] ]
if b < 0.9 [ set b b + (k * a) + (k * fc) + (k * fd')
if b > 0.9 [ set b 0.9 ] ]
if b > 0.1 [ set b b - (k * fe')
if b < 0.1 [ set b 0.1 ] ]
]
end









share|improve this question






























    0















    I'm checking the interaction among the properties of three types of patches by using 'one-of neighbors' command. Problem occurs when the two patches are not neighboring to each other in some cases and entity NOBODY emerges. Is there any way to avoid this. It is necessary for me to use 'one-of neighbors' command. Can I give a command stating that if Nobody is detected then the value of the property of that patch be 0.1. In my code give below the problem occurs in the interaction b/w yellow patch and red patch as in some places red is not a neighbor of yellow.



    I tried writing a Nobody command it was not correct.I appreciate your advice.



    globals [ k ] ; interaction constant
    patches-own [ a b c d' e' eeep deep ] ; state variables of properties
    ; a is the Proportion and variety of Blend of land
    use
    ; b is the Land uses with supportiveness for
    complimentary activities
    ; c is the Vehicular and Pedestrian Intensity
    ; d is the Intensity of Nodes in urban web
    ; e' is the Frequency of Enforced Vigilance
    to setup
    clear-all
    set k initial-k
    setup-patches
    reset-ticks
    end
    to setup-patches
    ask patches [ set pcolor yellow ] ; defines the patches as built up in an area

    ; to define yellow patches without a and b
    ask patches [ if (pycor > 1) and (pycor < 8) and (pxcor = -3 ) [ set pcolor 46 ] ]
    ask patches [ if (pycor > 1) and (pycor < 8) and (pxcor = -2 ) [ set pcolor 46 ] ]
    ask patches [ if (pycor < -1) and (pxcor = -10 ) [ set pcolor 46 ] ]
    ask patches [ if (pycor < -1) and (pxcor = -9 ) [ set pcolor 46 ] ]
    ask patches [ if (pycor < -1) and (pxcor = -5 ) [ set pcolor 46 ] ]
    ask patches [ if (pycor < -1) and (pxcor = 2 ) [ set pcolor 46 ] ]
    ask patches [ if (pycor < -2) and (pxcor = 6 ) [ set pcolor 46 ] ]
    ask patches [ if (pycor > 1) and (pycor < 8) and (pxcor = 2 ) [ set pcolor 46 ] ]
    ask patches [ if (pycor = 2) and (pxcor > 8 ) [ set pcolor 46 ] ]
    ask patches [ if (pycor = -2) and (pxcor > 2 ) [ set pcolor 46 ] ]
    ask patches [ if (pycor = -3) and (pxcor > 6 ) [ set pcolor 46 ] ]
    ask patches [ if (pycor = -4) and (pxcor > 6 ) [ set pcolor 46 ] ]
    ask patches [ if (pycor = -8) and (pxcor > 6 ) [ set pcolor 46 ] ]
    ask patches [ if (pycor = -9) and (pxcor > 6 ) [ set pcolor 46 ] ]
    ask patches [ if (pycor = 7) and (pxcor > 8 ) [ set pcolor 46 ] ]
    ask patches [ if (pycor = 6) and (pxcor > 8 ) [ set pcolor 46 ] ]
    ask patches [ if (pycor = 2) and (pxcor > 2 ) and (pxcor < 6) [ set pcolor 46 ] ]

    ; to define road patches (horizontal)
    ask patches [ if pycor = 0 [ set pcolor grey ] ]
    ask patches [ if pxcor = 0 [ set pcolor grey ] ]
    ask patches [if pycor = 9 [ set pcolor grey ] ]
    ask patches [ if (pycor = 6) and (pxcor < -4 )[ set pcolor grey ] ]
    ask patches [ if (pycor = 3) and (pxcor < -4 ) [ set pcolor grey ] ]
    ask patches [ if (pycor = 4) and (pxcor > 3 ) [ set pcolor grey ] ]
    ask patches [ if (pycor = -6) and (pxcor > 7 ) [ set pcolor grey ] ]

    ; to define road patches (vertical)
    ask patches [ if (pycor > 0) and (pxcor = -10 ) [ set pcolor grey ] ]
    ask patches [ if (pycor > 0) and (pxcor = -5 ) [ set pcolor grey ] ]
    ask patches [ if (pycor < 0) and (pxcor = -7 ) [ set pcolor grey ] ]
    ask patches [ if (pycor < 0) and (pxcor = -3 ) [ set pcolor grey ] ]
    ask patches [ if (pycor < -3) and (pxcor = 4 ) [ set pcolor grey ] ]
    ask patches [ if (pycor > 3) and (pxcor = 4 ) [ set pcolor grey ] ]
    ask patches [ if (pycor > 0) and (pxcor = 7 ) [ set pcolor grey ] ]

    ; to define nodes as patches
    ask patches [ if pxcor = 0 and pycor = 0 [ set pcolor red ] ]
    ask patches [ if pxcor = 7 and pycor = 0 [ set pcolor red ] ]
    ask patches [ if pxcor = -3 and pycor = 0 [ set pcolor red ] ]
    ask patches [ if pxcor = -5 and pycor = 0 [ set pcolor red ] ]
    ask patches [ if pxcor = -7 and pycor = 0 [ set pcolor red ] ]
    ask patches [ if pxcor = -10 and pycor = 0 [ set pcolor red ] ]
    ask patches [ if pxcor = 4 and pycor = 4 [ set pcolor red ] ]
    ask patches [ if pxcor = 7 and pycor = 4 [ set pcolor red ] ]
    ask patches [ if pxcor = 7 and pycor = 9 [ set pcolor red ] ]
    ask patches [ if pxcor = 4 and pycor = 9 [ set pcolor red ] ]
    ask patches [ if pxcor = 0 and pycor = 9 [ set pcolor red ] ]
    ask patches [ if pxcor = -5 and pycor = 9 [ set pcolor red ] ]
    ask patches [ if pxcor = -10 and pycor = 9 [ set pcolor red ] ]
    ask patches [ if pxcor = -10 and pycor = 6 [ set pcolor red ] ]
    ask patches [ if pxcor = -10 and pycor = 3 [ set pcolor red ] ]
    ask patches [ if pxcor = -5 and pycor = 6 [ set pcolor red ] ]
    ask patches [ if pxcor = -5 and pycor = 3 [ set pcolor red ] ]

    ; to set intial values of properties for patches
    ask patches with [pcolor = yellow] [ set a random-float 0.9] ; initial a
    ask patches with [pcolor = yellow] [ set b random-float 0.9] ; initial b
    ask patches with [pcolor = grey] [ set c random-float 0.9] ; initial c
    ask patches with [pcolor = red] [ set d' random-float 0.9] ; initial d'
    ask patches with [pcolor = grey] [ set e' random-float 0.9] ; initial e'
    end
    to go
    tick
    if ticks >= 52 [ stop ]
    ask patches with [pcolor = yellow]
    [
    let fc [c] of one-of neighbors with [pcolor = grey] ; reports c of any
    one grey patch of neighbours
    let fe' [e'] of one-of neighbors with [pcolor = grey] ; reports e' of any one grey patch of neighbours
    let fd' [d'] of one-of neighbors with [pcolor = red]; reports d' of any one red patch of neighbours
    if a < 0.1 [ set a 0.1
    if a > 0.9 [ set a 0.9 ] ]
    if b < 0.9 [ set b b + (k * a) + (k * fc) + (k * fd')
    if b > 0.9 [ set b 0.9 ] ]
    if b > 0.1 [ set b b - (k * fe')
    if b < 0.1 [ set b 0.1 ] ]
    ]
    end









    share|improve this question


























      0












      0








      0








      I'm checking the interaction among the properties of three types of patches by using 'one-of neighbors' command. Problem occurs when the two patches are not neighboring to each other in some cases and entity NOBODY emerges. Is there any way to avoid this. It is necessary for me to use 'one-of neighbors' command. Can I give a command stating that if Nobody is detected then the value of the property of that patch be 0.1. In my code give below the problem occurs in the interaction b/w yellow patch and red patch as in some places red is not a neighbor of yellow.



      I tried writing a Nobody command it was not correct.I appreciate your advice.



      globals [ k ] ; interaction constant
      patches-own [ a b c d' e' eeep deep ] ; state variables of properties
      ; a is the Proportion and variety of Blend of land
      use
      ; b is the Land uses with supportiveness for
      complimentary activities
      ; c is the Vehicular and Pedestrian Intensity
      ; d is the Intensity of Nodes in urban web
      ; e' is the Frequency of Enforced Vigilance
      to setup
      clear-all
      set k initial-k
      setup-patches
      reset-ticks
      end
      to setup-patches
      ask patches [ set pcolor yellow ] ; defines the patches as built up in an area

      ; to define yellow patches without a and b
      ask patches [ if (pycor > 1) and (pycor < 8) and (pxcor = -3 ) [ set pcolor 46 ] ]
      ask patches [ if (pycor > 1) and (pycor < 8) and (pxcor = -2 ) [ set pcolor 46 ] ]
      ask patches [ if (pycor < -1) and (pxcor = -10 ) [ set pcolor 46 ] ]
      ask patches [ if (pycor < -1) and (pxcor = -9 ) [ set pcolor 46 ] ]
      ask patches [ if (pycor < -1) and (pxcor = -5 ) [ set pcolor 46 ] ]
      ask patches [ if (pycor < -1) and (pxcor = 2 ) [ set pcolor 46 ] ]
      ask patches [ if (pycor < -2) and (pxcor = 6 ) [ set pcolor 46 ] ]
      ask patches [ if (pycor > 1) and (pycor < 8) and (pxcor = 2 ) [ set pcolor 46 ] ]
      ask patches [ if (pycor = 2) and (pxcor > 8 ) [ set pcolor 46 ] ]
      ask patches [ if (pycor = -2) and (pxcor > 2 ) [ set pcolor 46 ] ]
      ask patches [ if (pycor = -3) and (pxcor > 6 ) [ set pcolor 46 ] ]
      ask patches [ if (pycor = -4) and (pxcor > 6 ) [ set pcolor 46 ] ]
      ask patches [ if (pycor = -8) and (pxcor > 6 ) [ set pcolor 46 ] ]
      ask patches [ if (pycor = -9) and (pxcor > 6 ) [ set pcolor 46 ] ]
      ask patches [ if (pycor = 7) and (pxcor > 8 ) [ set pcolor 46 ] ]
      ask patches [ if (pycor = 6) and (pxcor > 8 ) [ set pcolor 46 ] ]
      ask patches [ if (pycor = 2) and (pxcor > 2 ) and (pxcor < 6) [ set pcolor 46 ] ]

      ; to define road patches (horizontal)
      ask patches [ if pycor = 0 [ set pcolor grey ] ]
      ask patches [ if pxcor = 0 [ set pcolor grey ] ]
      ask patches [if pycor = 9 [ set pcolor grey ] ]
      ask patches [ if (pycor = 6) and (pxcor < -4 )[ set pcolor grey ] ]
      ask patches [ if (pycor = 3) and (pxcor < -4 ) [ set pcolor grey ] ]
      ask patches [ if (pycor = 4) and (pxcor > 3 ) [ set pcolor grey ] ]
      ask patches [ if (pycor = -6) and (pxcor > 7 ) [ set pcolor grey ] ]

      ; to define road patches (vertical)
      ask patches [ if (pycor > 0) and (pxcor = -10 ) [ set pcolor grey ] ]
      ask patches [ if (pycor > 0) and (pxcor = -5 ) [ set pcolor grey ] ]
      ask patches [ if (pycor < 0) and (pxcor = -7 ) [ set pcolor grey ] ]
      ask patches [ if (pycor < 0) and (pxcor = -3 ) [ set pcolor grey ] ]
      ask patches [ if (pycor < -3) and (pxcor = 4 ) [ set pcolor grey ] ]
      ask patches [ if (pycor > 3) and (pxcor = 4 ) [ set pcolor grey ] ]
      ask patches [ if (pycor > 0) and (pxcor = 7 ) [ set pcolor grey ] ]

      ; to define nodes as patches
      ask patches [ if pxcor = 0 and pycor = 0 [ set pcolor red ] ]
      ask patches [ if pxcor = 7 and pycor = 0 [ set pcolor red ] ]
      ask patches [ if pxcor = -3 and pycor = 0 [ set pcolor red ] ]
      ask patches [ if pxcor = -5 and pycor = 0 [ set pcolor red ] ]
      ask patches [ if pxcor = -7 and pycor = 0 [ set pcolor red ] ]
      ask patches [ if pxcor = -10 and pycor = 0 [ set pcolor red ] ]
      ask patches [ if pxcor = 4 and pycor = 4 [ set pcolor red ] ]
      ask patches [ if pxcor = 7 and pycor = 4 [ set pcolor red ] ]
      ask patches [ if pxcor = 7 and pycor = 9 [ set pcolor red ] ]
      ask patches [ if pxcor = 4 and pycor = 9 [ set pcolor red ] ]
      ask patches [ if pxcor = 0 and pycor = 9 [ set pcolor red ] ]
      ask patches [ if pxcor = -5 and pycor = 9 [ set pcolor red ] ]
      ask patches [ if pxcor = -10 and pycor = 9 [ set pcolor red ] ]
      ask patches [ if pxcor = -10 and pycor = 6 [ set pcolor red ] ]
      ask patches [ if pxcor = -10 and pycor = 3 [ set pcolor red ] ]
      ask patches [ if pxcor = -5 and pycor = 6 [ set pcolor red ] ]
      ask patches [ if pxcor = -5 and pycor = 3 [ set pcolor red ] ]

      ; to set intial values of properties for patches
      ask patches with [pcolor = yellow] [ set a random-float 0.9] ; initial a
      ask patches with [pcolor = yellow] [ set b random-float 0.9] ; initial b
      ask patches with [pcolor = grey] [ set c random-float 0.9] ; initial c
      ask patches with [pcolor = red] [ set d' random-float 0.9] ; initial d'
      ask patches with [pcolor = grey] [ set e' random-float 0.9] ; initial e'
      end
      to go
      tick
      if ticks >= 52 [ stop ]
      ask patches with [pcolor = yellow]
      [
      let fc [c] of one-of neighbors with [pcolor = grey] ; reports c of any
      one grey patch of neighbours
      let fe' [e'] of one-of neighbors with [pcolor = grey] ; reports e' of any one grey patch of neighbours
      let fd' [d'] of one-of neighbors with [pcolor = red]; reports d' of any one red patch of neighbours
      if a < 0.1 [ set a 0.1
      if a > 0.9 [ set a 0.9 ] ]
      if b < 0.9 [ set b b + (k * a) + (k * fc) + (k * fd')
      if b > 0.9 [ set b 0.9 ] ]
      if b > 0.1 [ set b b - (k * fe')
      if b < 0.1 [ set b 0.1 ] ]
      ]
      end









      share|improve this question














      I'm checking the interaction among the properties of three types of patches by using 'one-of neighbors' command. Problem occurs when the two patches are not neighboring to each other in some cases and entity NOBODY emerges. Is there any way to avoid this. It is necessary for me to use 'one-of neighbors' command. Can I give a command stating that if Nobody is detected then the value of the property of that patch be 0.1. In my code give below the problem occurs in the interaction b/w yellow patch and red patch as in some places red is not a neighbor of yellow.



      I tried writing a Nobody command it was not correct.I appreciate your advice.



      globals [ k ] ; interaction constant
      patches-own [ a b c d' e' eeep deep ] ; state variables of properties
      ; a is the Proportion and variety of Blend of land
      use
      ; b is the Land uses with supportiveness for
      complimentary activities
      ; c is the Vehicular and Pedestrian Intensity
      ; d is the Intensity of Nodes in urban web
      ; e' is the Frequency of Enforced Vigilance
      to setup
      clear-all
      set k initial-k
      setup-patches
      reset-ticks
      end
      to setup-patches
      ask patches [ set pcolor yellow ] ; defines the patches as built up in an area

      ; to define yellow patches without a and b
      ask patches [ if (pycor > 1) and (pycor < 8) and (pxcor = -3 ) [ set pcolor 46 ] ]
      ask patches [ if (pycor > 1) and (pycor < 8) and (pxcor = -2 ) [ set pcolor 46 ] ]
      ask patches [ if (pycor < -1) and (pxcor = -10 ) [ set pcolor 46 ] ]
      ask patches [ if (pycor < -1) and (pxcor = -9 ) [ set pcolor 46 ] ]
      ask patches [ if (pycor < -1) and (pxcor = -5 ) [ set pcolor 46 ] ]
      ask patches [ if (pycor < -1) and (pxcor = 2 ) [ set pcolor 46 ] ]
      ask patches [ if (pycor < -2) and (pxcor = 6 ) [ set pcolor 46 ] ]
      ask patches [ if (pycor > 1) and (pycor < 8) and (pxcor = 2 ) [ set pcolor 46 ] ]
      ask patches [ if (pycor = 2) and (pxcor > 8 ) [ set pcolor 46 ] ]
      ask patches [ if (pycor = -2) and (pxcor > 2 ) [ set pcolor 46 ] ]
      ask patches [ if (pycor = -3) and (pxcor > 6 ) [ set pcolor 46 ] ]
      ask patches [ if (pycor = -4) and (pxcor > 6 ) [ set pcolor 46 ] ]
      ask patches [ if (pycor = -8) and (pxcor > 6 ) [ set pcolor 46 ] ]
      ask patches [ if (pycor = -9) and (pxcor > 6 ) [ set pcolor 46 ] ]
      ask patches [ if (pycor = 7) and (pxcor > 8 ) [ set pcolor 46 ] ]
      ask patches [ if (pycor = 6) and (pxcor > 8 ) [ set pcolor 46 ] ]
      ask patches [ if (pycor = 2) and (pxcor > 2 ) and (pxcor < 6) [ set pcolor 46 ] ]

      ; to define road patches (horizontal)
      ask patches [ if pycor = 0 [ set pcolor grey ] ]
      ask patches [ if pxcor = 0 [ set pcolor grey ] ]
      ask patches [if pycor = 9 [ set pcolor grey ] ]
      ask patches [ if (pycor = 6) and (pxcor < -4 )[ set pcolor grey ] ]
      ask patches [ if (pycor = 3) and (pxcor < -4 ) [ set pcolor grey ] ]
      ask patches [ if (pycor = 4) and (pxcor > 3 ) [ set pcolor grey ] ]
      ask patches [ if (pycor = -6) and (pxcor > 7 ) [ set pcolor grey ] ]

      ; to define road patches (vertical)
      ask patches [ if (pycor > 0) and (pxcor = -10 ) [ set pcolor grey ] ]
      ask patches [ if (pycor > 0) and (pxcor = -5 ) [ set pcolor grey ] ]
      ask patches [ if (pycor < 0) and (pxcor = -7 ) [ set pcolor grey ] ]
      ask patches [ if (pycor < 0) and (pxcor = -3 ) [ set pcolor grey ] ]
      ask patches [ if (pycor < -3) and (pxcor = 4 ) [ set pcolor grey ] ]
      ask patches [ if (pycor > 3) and (pxcor = 4 ) [ set pcolor grey ] ]
      ask patches [ if (pycor > 0) and (pxcor = 7 ) [ set pcolor grey ] ]

      ; to define nodes as patches
      ask patches [ if pxcor = 0 and pycor = 0 [ set pcolor red ] ]
      ask patches [ if pxcor = 7 and pycor = 0 [ set pcolor red ] ]
      ask patches [ if pxcor = -3 and pycor = 0 [ set pcolor red ] ]
      ask patches [ if pxcor = -5 and pycor = 0 [ set pcolor red ] ]
      ask patches [ if pxcor = -7 and pycor = 0 [ set pcolor red ] ]
      ask patches [ if pxcor = -10 and pycor = 0 [ set pcolor red ] ]
      ask patches [ if pxcor = 4 and pycor = 4 [ set pcolor red ] ]
      ask patches [ if pxcor = 7 and pycor = 4 [ set pcolor red ] ]
      ask patches [ if pxcor = 7 and pycor = 9 [ set pcolor red ] ]
      ask patches [ if pxcor = 4 and pycor = 9 [ set pcolor red ] ]
      ask patches [ if pxcor = 0 and pycor = 9 [ set pcolor red ] ]
      ask patches [ if pxcor = -5 and pycor = 9 [ set pcolor red ] ]
      ask patches [ if pxcor = -10 and pycor = 9 [ set pcolor red ] ]
      ask patches [ if pxcor = -10 and pycor = 6 [ set pcolor red ] ]
      ask patches [ if pxcor = -10 and pycor = 3 [ set pcolor red ] ]
      ask patches [ if pxcor = -5 and pycor = 6 [ set pcolor red ] ]
      ask patches [ if pxcor = -5 and pycor = 3 [ set pcolor red ] ]

      ; to set intial values of properties for patches
      ask patches with [pcolor = yellow] [ set a random-float 0.9] ; initial a
      ask patches with [pcolor = yellow] [ set b random-float 0.9] ; initial b
      ask patches with [pcolor = grey] [ set c random-float 0.9] ; initial c
      ask patches with [pcolor = red] [ set d' random-float 0.9] ; initial d'
      ask patches with [pcolor = grey] [ set e' random-float 0.9] ; initial e'
      end
      to go
      tick
      if ticks >= 52 [ stop ]
      ask patches with [pcolor = yellow]
      [
      let fc [c] of one-of neighbors with [pcolor = grey] ; reports c of any
      one grey patch of neighbours
      let fe' [e'] of one-of neighbors with [pcolor = grey] ; reports e' of any one grey patch of neighbours
      let fd' [d'] of one-of neighbors with [pcolor = red]; reports d' of any one red patch of neighbours
      if a < 0.1 [ set a 0.1
      if a > 0.9 [ set a 0.9 ] ]
      if b < 0.9 [ set b b + (k * a) + (k * fc) + (k * fd')
      if b > 0.9 [ set b 0.9 ] ]
      if b > 0.1 [ set b b - (k * fe')
      if b < 0.1 [ set b 0.1 ] ]
      ]
      end






      runtime netlogo






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 28 at 7:29









      Nimisha SamadhiyaNimisha Samadhiya

      51 bronze badge




      51 bronze badge

























          1 Answer
          1






          active

          oldest

          votes


















          1
















          I am guessing that the part of the code throwing the error is (for future reference, it is helpful if you try to focus on the part of the code that is causing the problem):



          ask patches with [pcolor = yellow]
          [ let fc [c] of one-of neighbors with [pcolor = grey]
          let fe' [e'] of one-of neighbors with [pcolor = grey]
          let fd' [d'] of one-of neighbors with [pcolor = red]
          ...
          ]
          end


          The primitive you want is any?. So you could rewrite:



          let fc [c] of one-of neighbors with [pcolor = grey] 


          as



          let grey neighbors with [pcolor = grey]
          let fc 0.1
          if any? greys
          [ set fc [c] of one-of greys ]


          Alternatively



          let grey neighbors with [pcolor = grey]
          let fc ifelse-value any? greys
          [ [c] of one-of greys ]
          [ 0.1 ]


          Note that neither of these pieces of code is tested.






          share|improve this answer

























          • Thank you so much. I'll try it. :)

            – Nimisha Samadhiya
            Mar 29 at 11:13










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );














          draft saved

          draft discarded
















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55392214%2fhow-to-avoid-nobody-run-time-error-in-netlogo%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1
















          I am guessing that the part of the code throwing the error is (for future reference, it is helpful if you try to focus on the part of the code that is causing the problem):



          ask patches with [pcolor = yellow]
          [ let fc [c] of one-of neighbors with [pcolor = grey]
          let fe' [e'] of one-of neighbors with [pcolor = grey]
          let fd' [d'] of one-of neighbors with [pcolor = red]
          ...
          ]
          end


          The primitive you want is any?. So you could rewrite:



          let fc [c] of one-of neighbors with [pcolor = grey] 


          as



          let grey neighbors with [pcolor = grey]
          let fc 0.1
          if any? greys
          [ set fc [c] of one-of greys ]


          Alternatively



          let grey neighbors with [pcolor = grey]
          let fc ifelse-value any? greys
          [ [c] of one-of greys ]
          [ 0.1 ]


          Note that neither of these pieces of code is tested.






          share|improve this answer

























          • Thank you so much. I'll try it. :)

            – Nimisha Samadhiya
            Mar 29 at 11:13















          1
















          I am guessing that the part of the code throwing the error is (for future reference, it is helpful if you try to focus on the part of the code that is causing the problem):



          ask patches with [pcolor = yellow]
          [ let fc [c] of one-of neighbors with [pcolor = grey]
          let fe' [e'] of one-of neighbors with [pcolor = grey]
          let fd' [d'] of one-of neighbors with [pcolor = red]
          ...
          ]
          end


          The primitive you want is any?. So you could rewrite:



          let fc [c] of one-of neighbors with [pcolor = grey] 


          as



          let grey neighbors with [pcolor = grey]
          let fc 0.1
          if any? greys
          [ set fc [c] of one-of greys ]


          Alternatively



          let grey neighbors with [pcolor = grey]
          let fc ifelse-value any? greys
          [ [c] of one-of greys ]
          [ 0.1 ]


          Note that neither of these pieces of code is tested.






          share|improve this answer

























          • Thank you so much. I'll try it. :)

            – Nimisha Samadhiya
            Mar 29 at 11:13













          1














          1










          1









          I am guessing that the part of the code throwing the error is (for future reference, it is helpful if you try to focus on the part of the code that is causing the problem):



          ask patches with [pcolor = yellow]
          [ let fc [c] of one-of neighbors with [pcolor = grey]
          let fe' [e'] of one-of neighbors with [pcolor = grey]
          let fd' [d'] of one-of neighbors with [pcolor = red]
          ...
          ]
          end


          The primitive you want is any?. So you could rewrite:



          let fc [c] of one-of neighbors with [pcolor = grey] 


          as



          let grey neighbors with [pcolor = grey]
          let fc 0.1
          if any? greys
          [ set fc [c] of one-of greys ]


          Alternatively



          let grey neighbors with [pcolor = grey]
          let fc ifelse-value any? greys
          [ [c] of one-of greys ]
          [ 0.1 ]


          Note that neither of these pieces of code is tested.






          share|improve this answer













          I am guessing that the part of the code throwing the error is (for future reference, it is helpful if you try to focus on the part of the code that is causing the problem):



          ask patches with [pcolor = yellow]
          [ let fc [c] of one-of neighbors with [pcolor = grey]
          let fe' [e'] of one-of neighbors with [pcolor = grey]
          let fd' [d'] of one-of neighbors with [pcolor = red]
          ...
          ]
          end


          The primitive you want is any?. So you could rewrite:



          let fc [c] of one-of neighbors with [pcolor = grey] 


          as



          let grey neighbors with [pcolor = grey]
          let fc 0.1
          if any? greys
          [ set fc [c] of one-of greys ]


          Alternatively



          let grey neighbors with [pcolor = grey]
          let fc ifelse-value any? greys
          [ [c] of one-of greys ]
          [ 0.1 ]


          Note that neither of these pieces of code is tested.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 28 at 10:46









          JenBJenB

          10.3k1 gold badge11 silver badges37 bronze badges




          10.3k1 gold badge11 silver badges37 bronze badges















          • Thank you so much. I'll try it. :)

            – Nimisha Samadhiya
            Mar 29 at 11:13

















          • Thank you so much. I'll try it. :)

            – Nimisha Samadhiya
            Mar 29 at 11:13
















          Thank you so much. I'll try it. :)

          – Nimisha Samadhiya
          Mar 29 at 11:13





          Thank you so much. I'll try it. :)

          – Nimisha Samadhiya
          Mar 29 at 11:13








          Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







          Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.




















          draft saved

          draft discarded















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55392214%2fhow-to-avoid-nobody-run-time-error-in-netlogo%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

          Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript