我怎样才能让一只乌龟(玩家)在遇到并决定携带它时携带另一只乌龟(球)?
How can i make a turtle (player) carry another turtle (ball) when encountered and decides to carry it?
我正在尝试制作一个模型,其中有一只乌龟(玩家)在玩家到达球并决定携带它时捡起一个球(作为乌龟)。
任何相关的内置功能?
使用tie
.
breed [balls ball]
breed [fetchers fetcher]
to setup
ca
create-balls 40 [
setxy random-xcor random-ycor
set shape "circle"
]
create-fetchers 1 [set size 2]
end
to go
ask fetchers [move]
end
to move ;turtle proc
set heading (heading - 45 + random 91)
fd 1
let _candidates balls-here
if any? _candidates [
create-link-with one-of _candidates [tie]
]
end
我正在尝试制作一个模型,其中有一只乌龟(玩家)在玩家到达球并决定携带它时捡起一个球(作为乌龟)。 任何相关的内置功能?
使用tie
.
breed [balls ball]
breed [fetchers fetcher]
to setup
ca
create-balls 40 [
setxy random-xcor random-ycor
set shape "circle"
]
create-fetchers 1 [set size 2]
end
to go
ask fetchers [move]
end
to move ;turtle proc
set heading (heading - 45 + random 91)
fd 1
let _candidates balls-here
if any? _candidates [
create-link-with one-of _candidates [tie]
]
end