1
にコピーする次のコードでは、変数regimeを出力するときに "A"または "D"を取得しますが、regimepまたはregimecを印刷すると["A"]または["D"]を入力します。パッチ自身の変数をタートル自身の
関連するコードは次のとおりです。
これらのブラケットから来ているpatches-own [
regimep
]
governments-own [
regime
]
citizens-own [
regimec
]
...
to set-governments
ask governments [
...
ifelse random 100 < democracies% [set regime "D"] [set regime "A"]
ifelse regime = "D" [set shape "star"] [set shape "circle"]
...
]
end
to set-citizens
ask citizens [
let x governments with [idgov = [idcit] of myself] ;; idgov is a variable of the breed governments and idcit is a variable for citizens
set regimec [regime] of x
]
end
to set-patches
ask patches [
let x governments with [idgov = [idpat] of myself]
set regimed [regime] of x
]
end
?ブラケットを使わずに変数を出力できるようにする必要があります。 ありがとうございました。
あなたのコードは、内側にset-patchesと書いてあります:xのregimed [regime]を設定しますが、あなたのパッチ変数はregimepです。あなたは代わりに摂政について尋ねていますか? – mattsap