如何在Netlogo的代码中设置笔大小滑块
这是我的代码,我需要适应滑块,所以我编辑笔大小我的全局变量是海龟笔大小如何在Netlogo的代码中设置笔大小滑块,netlogo,Netlogo,这是我的代码,我需要适应滑块,所以我编辑笔大小我的全局变量是海龟笔大小 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 siz
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[
ifelse pen-down? [ pen-down ] [ pen-up ]
fd 1
]
end
您可以设置
笔大小
您要求每只乌龟放下笔的位置
我不确定您想在代码中做什么,您的代码中没有定义放下笔?
,我假设您有一个定义放下笔的乌龟属性?对于其中一个值true和false,如果您将其定义为全局值,我相信您所有的海龟最终都具有相同的值,对于笔大小,您可以使用以下代码
set pen-size turtle-pen-size
这是您完成的代码:
turtles-own[pen-down?]
to setup
clear-all
reset-ticks
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 pen-size turtle-pen-size
set pen-down? one-of [true false]
]
set-default-shape turtles "circle"
end
to go
ask turtles[
ifelse pen-down?
[ pen-down ]
[ pen-up ]
fd 1
]
tick
end
你能告诉我们你自己解决这个问题的方法吗?你到底是在哪里被卡住的?我没有看到任何代码与笔的大小有关。