Hello,
Here is the code in question:
if not any? celluloses with [mychainlength > 1] ; check stop conditions for simulations and print outputs
[
output-print "All cellulose degraded"
output-print "Number of iterations required for complete breakdown of cellulose:"
output-print ticks
; stop
]
if not any? celluloses with [ycor > (- SetMargin) + 1] ; check stop conditions for simulations and print outputs
[
if GlucoseIntake = true
[
output-print "Glucose intake complete"
output-print "Number of iterations required for complete glucose intake:"
output-print ticks
stop
]
]
What happens is if not any? celluloses with [mychainlength > 1] always happens before if not any? celluloses with [ycor > (- SetMargin) + 1] and then till if not any? celluloses with [ycor > (- SetMargin) + 1] happens, all the output inside if not any? celluloses with [mychainlength > 1] are printed . Is there any way to execute if not any? celluloses with [mychainlength > 1] only once? Any method to come out of a procedure without using stop?
Thank you.
Advait
Education is a risky business
From: Advait Ashok Apte <advait_apte2002@...>
To: netlogo-users@yahoogroups.com
Sent: Wednesday, 1 July, 2009 17:05:07
Subject: Re: [netlogo-users] Re: concise code
Here is the code in question:
if not any? celluloses with [mychainlength > 1] ; check stop conditions for simulations and print outputs
[
output-print "All cellulose degraded"
output-print "Number of iterations required for complete breakdown of cellulose:"
output-print ticks
; stop
]
if not any? celluloses with [ycor > (- SetMargin) + 1] ; check stop conditions for simulations and print outputs
[
if GlucoseIntake = true
[
output-print "Glucose intake complete"
output-print "Number of iterations required for complete glucose intake:"
output-print ticks
stop
]
]
What happens is if not any? celluloses with [mychainlength > 1] always happens before if not any? celluloses with [ycor > (- SetMargin) + 1] and then till if not any? celluloses with [ycor > (- SetMargin) + 1] happens, all the output inside if not any? celluloses with [mychainlength > 1] are printed . Is there any way to execute if not any? celluloses with [mychainlength > 1] only once? Any method to come out of a procedure without using stop?
Thank you.
Advait
Education is a risky business
From: Advait Ashok Apte <advait_apte2002@...>
To: netlogo-users@yahoogroups.com
Sent: Wednesday, 1 July, 2009 17:05:07
Subject: Re: [netlogo-users] Re: concise code
Hello,
Here is the code in question:
if not any? celluloses with [mychainlength > 1] ; check stop conditions for simulations and print outputs
[
output-print "All cellulose degraded"
output-print "Number of iterations required for complete breakdown of cellulose:"
output-print ticks
; stop
]
if not any? celluloses with [ycor > (- SetMargin) + 1] ; check stop conditions for simulations and print outputs
[
if GlucoseIntake = true
[
output-print "Glucose intake complete"
output-print "Number of iterations required for complete glucose intake:"
output-print ticks
stop
]
]
What happens is if not any? celluloses with [mychainlength > 1] always happens before if not any? celluloses with [ycor > (- SetMargin) + 1] and then till if not any? celluloses with [ycor > (- SetMargin) + 1] happens, all the output inside if not any? celluloses with [mychainlength > 1] are printed . Is there any way to execute if not any? celluloses with [mychainlength > 1] only once? Any method to come out of a procedure without using stop?
Thank you.
Advait
Education is a risky business
From: Jim Lyons <teacherjim42@ gmail.com>
To: netlogo-users@ yahoogroups. com
Sent: Sunday, 28 June, 2009 10:48:47
Subject: Re: [netlogo-users] Re: concise code
Here is the code in question:
if not any? celluloses with [mychainlength > 1] ; check stop conditions for simulations and print outputs
[
output-print "All cellulose degraded"
output-print "Number of iterations required for complete breakdown of cellulose:"
output-print ticks
; stop
]
if not any? celluloses with [ycor > (- SetMargin) + 1] ; check stop conditions for simulations and print outputs
[
if GlucoseIntake = true
[
output-print "Glucose intake complete"
output-print "Number of iterations required for complete glucose intake:"
output-print ticks
stop
]
]
What happens is if not any? celluloses with [mychainlength > 1] always happens before if not any? celluloses with [ycor > (- SetMargin) + 1] and then till if not any? celluloses with [ycor > (- SetMargin) + 1] happens, all the output inside if not any? celluloses with [mychainlength > 1] are printed . Is there any way to execute if not any? celluloses with [mychainlength > 1] only once? Any method to come out of a procedure without using stop?
Thank you.
Advait
Education is a risky business
From: Jim Lyons <teacherjim42@ gmail.com>
To: netlogo-users@ yahoogroups. com
Sent: Sunday, 28 June, 2009 10:48:47
Subject: Re: [netlogo-users] Re: concise code
Here is yet another approach to the problem. A patch-set of the square's sides is created and then 50 of them sprout the turtles:
breed [ turs tur ]
to test
let side-patches patches with [abs pycor = 14 and in-range? pxcor -14 14
or abs pxcor = 14 and
in-range? pycor -14 14]
ask n-of 50 side-patches [ sprout-turs 1 [ set color blue ] ]
end
to-report in-range? [value low high]
report low <= value and value <= high
end
Jim
On Jun 27, 2009, at 7:49 PM, Advait Ashok Apte wrote:
What I was trying is to create randomness in setting ycor and xcor to 14 or -14. So SOME out of 50 will have xcor set to 14 or -14 and REST will have ycor set.
I was precisely trying not to have more than 1 turtles on same patch!!! Thank you again in advance for answers to my issues.