以下代码行通知乌龟(入店行窃者)的决定:1)他们对风险的认识是否足够低以尝试入店行窃;以及2)是否被捕入商店行窃。
如果风险感知力为60或更低,并且他们先前并未阻止入店行窃,他们会尝试入店行窃。
忧虑有两个作用。对于被抓的行窃者,担心会阻止97%的非专业行窃者再次进入商店。对于打算针对同一家商店的多达5个潜在的入店行窃者,他们在该商店的入店行窃风险感知增加了5。
我的问题是这样的:解释/代码行旁边有星号,这行得通吗?我试图增加与被捕的乌龟具有相同目标库的乌龟的风险感。
to number-shoplifts
ask shoplifters [ if [pcolor] of patch-here = lime and
perception-of-risk <= 60 and forever-deterred = 0
[ifelse (random-float 1 < 0.98) [
set successful-shoplifts successful-shoplifts + 1 ]
[ifelse (random-float 1 < 0.05) [
set successful-shoplifts successful-shoplifts + 0 ]
[ifelse (random-float 1 < 0.99 ) [
set security-apprehension security-apprehension + 1
if professional = 0 and (random-float 1 < 0.97) [set forever-deterred 1]
*** ask n-of 5 shoplifters [if target-store = patch-here [ set perception-of-risk perception-of-risk + 5 ]]
]
[set successful-shoplifts successful-shoplifts + 1 ]
]]]]
end
答案 0 :(得分:2)
测试类似方法是否可行的最简单方法是添加一些可见的更改。将指示的行替换为:
ask n-of 5 shoplifters
[ write target-store write " with risk " print perception-of-risk
if target-store = patch-here
[ set perception-of-risk perception-of-risk + 5
set color red
show perception-of-risk ]
]
想法是要有一些输出来告诉您正在发生的事情。