我有兩個列表和一個值(在每個補丁中)。我想將單個值與列表結合起來,然後爲每個交互設置一個特定的權重值。例如Netlogo,從列表和單個值的組合中選擇一個值
let single random 3; represent the center patch
let list1 [ 0 1 2 2 1 0 0 2 ]; represent the moore neighbors values
let weights [0.2 0.3 0.5 0.1 0.8 0.1 0.6 0.2 0.2 ]; combination of centerpatch and neighb.
我想創建一個新的列表(列表2),在爲單每個組合列表1得到一個特定的權重值。例如 如果單= 0和列表1 = 0,則列表2將有0.2 如果單= 1和list1的= 1,則列表2將有0.8等..
我試圖用「ifelse值」但沒有成功。
let single_and_list sentence single list1
let condition1 map [ifelse-value (? = 0 and list1 = 0 ) [0.2][?]] single_and_list
let condition2 map [ifelse-value (? = 1 and list1 = 1 ) [0.8][?]] single_and_list
let list2 [condition1, condition2,….]
,我將不勝感激任何見解感謝