【发布时间】:2014-11-08 05:26:57
【问题描述】:
我有两个品种的 turtle(A) 和 turtle(B):
Turtle(A) 在世界各地随机移动。
当
turtle(A)遇到turtle(B)时,我希望turtle(B)移动到围绕坐标的半径内,从而希望形成一个圆。
任何帮助/提示?
【问题讨论】:
标签: geometry netlogo turtle-graphics
我有两个品种的 turtle(A) 和 turtle(B):
Turtle(A) 在世界各地随机移动。
当turtle(A) 遇到turtle(B) 时,我希望turtle(B) 移动到围绕坐标的半径内,从而希望形成一个圆。
任何帮助/提示?
【问题讨论】:
标签: geometry netlogo turtle-graphics
该规范有点不完整,但这可能会让您入门:
globals [lst]
breed [taggers tagger]
breed [taggeds tagged]
taggeds-own [caught?]
to setup
ca
set lst []
ask n-of 50 patches [sprout-taggeds 1 [set caught? false]]
ask n-of 5 patches [sprout-taggers 1]
end
to move ;;turtle proc
ask taggeds [
if not caught? [
move-to one-of neighbors
]
]
end
to tag ;;tagger proc
let candidates taggeds-on neighbors
if any? candidates [
let captured one-of candidates
ask captured [set caught? true]
set lst lput captured lst
]
end
to go
ask turtles [move]
ask taggers [tag]
layout-circle lst 5 ;;aribtary radius of 5
end
【讨论】: