1
私は2つの品種:suprasとsubsを持っています。近所の品種を数える(プロットする)
- (カメの総 人口で割った値)suprasある隣人を持っている潜水艦の数
- が潜水艦であることを隣人を持っているsuprasの数:私は2本の線を描画したい
(カメの総人口で割ったもの)
どうすればいいですか?私はこれを試してみた:
plot count (subs with [one-of neighbors = supras])/num-turtles
plot count (supras with [one-of neighbors = subs])/num-turtles
数はケースではありません各集団のためには常に0です。そうneighbors = supras
はあなたが何のパッチがsupras
またはsubs
ませんneed-あなたのものを手に入れるつもりはないと言って、
breed [supras supra]
breed [subs sub]
turtles-own [age]
subs-own [status]
to setup
clear-all
;; Color the patches so they're easier to see
ask patches [ set pcolor random-float 2 ]
;; 1/2 of num-turtles patches will sprout subs
ask n-of (num-turtles/2) patches [
if not any? turtles-on patch-set self [
sprout-subs 1
]
]
;; 1/2 of num-turtles patches will sprout supras
ask n-of (num-turtles/2) patches [
if not any? turtles-on patch-set self [
sprout-supras 1
]
]
;; Set breed colors and own-variables
ask subs [
set color blue
set shape "dot"
set age 0
set status random 10
]
ask supras [
set color pink
set shape "dot"
set age 0
]
reset-ticks
end
to go
ask turtles [
let empty-patches neighbors with [not any? turtles-here]
if any? empty-patches[
let target one-of empty-patches
face target
move-to target
]
]
;; Mating conditions
ask supras [
if any? subs-on neighbors [
;; Mate with highest status sub
mate
]
]
tick
end
to mate
move-to max-one-of subs [status]
end
お世話になりました。私は学ぶために遊んでいます。 NetLogoではどのような作業をしていますか? – santafebound
あなたは賭けました!それは確かに周りを遊ぶための楽しいプログラムです。私のgradプロジェクトの一部はNetlogoを使用しています。このサイトから1トンのメリットを得ています。ユーザーは非常に役立っています。 –