1
因此,我在網絡標誌中編寫了一個簡短的程序,我想根據他們自己擁有的變量view
對我的海龜進行顏色編碼。我試圖在netlogo中使用color-scale
定義顏色,但它不完全符合我的要求。在netlogo中動態更改rgb
我寫了這個來描述我想要的,但是當我將col
變量傳遞給set color
命令時,netlogo似乎會感到困惑。
to colorise;;------------------------------------------------------------
; this changes the agent's colour based on their current [view] score.
; We could use the color-scale in netlogo, but it only works for one colour
; and it's easy to end up with a colour so dark we can't see it against black patches.
moderate ; resets any agents which have somehow ended up with a view score outside -1 to +1
ifelse view > 0
[ let col (1 - view)
set col col * 255
set color [ 255 col col ]
]
[ let col (1 + view)
set col col * 255
set color [ col col 255 ]
]
end
沒有人有任何想法嗎?
謝謝!
請問
http://ccl.northwestern.edu/netlogo/docs/faq.html#listexpectedconstant – 2015-04-02 14:11:37