【问题标题】:How to set a turtle's colour to match another turtle?如何设置乌龟的颜色以匹配另一只乌龟?
【发布时间】:2022-12-09 09:52:39
【问题描述】:

这个非常简单,但我一直遇到有关颜色存储方式的问题。以下两个都会产生错误,指出颜色应该是 RGB 的三个数字。

让 topTurtle 的温度 [颜色] 问海龟[设置色温]

或者

问海龟 [设置颜色 [topturtle 的颜色]]

请问这样做的正确方法是什么?

【问题讨论】:

  • 您是否有机会在 Netlogo 的测试版中工作?在网络版本上,他们目前正在测试我们的 RGB 颜色值

标签: netlogo


【解决方案1】:

你的第二个选项应该是ask turtles [set color [color] of topturtle],你把括号放错了。

除了那个错误,这两个选项对我来说都很好。 如果我在命令中心输入以下几行,它们就可以正常工作。

crt 5 [setxy random-xcor random-ycor]
let temp [color] of turtle 0 ask turtles [set color temp]

同样适用于

crt 5 [setxy random-xcor random-ycor]
ask turtles [set color [color] of turtle 0]

【讨论】:

  • 是的,我的代码之前有一个错误。谢谢。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-11-19
  • 2013-12-17
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多