我是netlogo的新手我有一个课程工作,我做了大部分,但我不能设置笔与交换机一起工作,我应该写为代码,这是我的代码
turtles-own [pen ]
to setup
clear-all
ask patches [ set pcolor sky ]
setup-turtles
end
to setup-turtles
create-turtles turtles-to-create
[ set color lime setxy random-xcor random-ycor set size size-of-turtle]
set-default-shape turtles "circle"
end
to go
ask turtles
[
fd 1
]
end
to goforever
ask turtles
[
fd 1
]
end
答案 0 :(得分:4)
如果您的开关变量名为draw-paths?
,那么您可以执行以下操作:
to go
ask turtles [
ifelse draw-paths? [ pen-down ] [ pen-up ]
fd 1
]
end
顺便说一句,您不需要go
和goforever
程序。只需创建一个名为go
的永久按钮。