亀を動かすのをやめようとしているのは、patch-ahead 1 condition
です。それは、次の隣接パッチで特定の性質を持つ別のカメ、実際には が見つかった場合には、私は固定カメに達すると、互いに隣接するカメを止めたい。亀が止まる前にパッチアウェイ条件が働かない
ifelse (not any? (turtles-on patch-ahead 1) with [stationary? = true]) [
fd 0.1
rt random 360
] [
set stationary? true
stop
]
は実際に、私は「import-pcolors
」コマンドを使用してインポートを描く中で、私のカメを停止させるためのパッチ先読み1つの条件を使用しています。
世界の斑点の中央には図形や形(星形魚など)が並んでいて、終わりまで固定された形状描写内に4匹のカメ(種子)が原点の中心近くに配置され、他のすべての亀無作為に配置され、無作為に移動します。stationary? = false
。
目的は、亀をランダムに移動させて次の固定カメに近づくと停止し、stationary? = true
になり、他の残りの非定常の参照を完全に埋めることですカメ。ここ
は、私がこれまで試してみました、私が達成したい
to setup
import-pcolors "starnew.png" ; image imported in the world on patches for turtles to interact
create-robots num-of-robots
[
set seed? false
set stationary? false
set shape "circle 2"
setxy random-pxcor random-pycor
]
ask turtles
[
if who = 0 ; similarly for who = 1 (setxy = 0 1), who = 2 (setxy = 1 0), who = 3 (setxy = 0 -1), having loaction near centre origin
[
setxy 0 0
set seed? true
set stationary? true
set localized? true
]
]
end
to go
ask robots with [stationary? != true]
[
ifelse pcolor = white ;; out-shape
[
wall
fd 0.1
rt random 30
lt random 30
]
[ ;; In-shape
set pos-inside? true
ifelse (not any? (robots-on patch-ahead 1) with [stationary? = true or seed? = true] )
[
fd 0.1
rt random 30
lt random 30
]
[
set pos-inside? true
set stationary? true
set localized? true
stop
]
]
]
end
ルークC、あなたの親切な助けをありがとう。 あなたはそれを得ました。 –
しかし私は私のシナリオを明らかにする。 –