Netlogo图案填充-继承品种

Netlogo图案填充-继承品种,netlogo,Netlogo,在下面的代码中,当我们执行hatch1时,哪个品种有一只新海龟-星星?或者它没有品种-只继承最后一个?变量 breed [stars a-star] stars-own [ last-one? ] create-stars 1 [ set color brown set heading 0 hatch 1 [ set color green fd 1

在下面的代码中,当我们执行
hatch1
时,哪个品种有一只新海龟-
星星
?或者它没有品种-只继承最后一个?变量

breed [stars a-star]
    stars-own [
      last-one?
    ]

    create-stars 1
      [
        set color brown
        set heading 0
        hatch 1
        [
          set color green fd 1
          set last-one? false ;; don't remember
        ]
      ]

使用
hatch
,新海龟的所有属性值都与父海龟的属性值完全相同。这包括
品种
,这是海龟自动拥有的属性(很像大小、x-cor等)。下面是一个稍微扩展的代码版本,它向您展示了您的答案,同时也展示了如何直接将
breed
作为属性使用

breed [stars a-star]
stars-own [
  last-one?
]

to setup
  clear-all
  create-stars 1
  [ set color brown
    set heading 0
    hatch 1
    [ set color green fd 1
      set last-one? false ;; don't remember
    ]
  ]
  type "Number of stars: " print count stars
  type "Number of other turtles: " print count turtles with [breed != stars]
end