私はNetLogoを初めて使用しています。光源のパッチを越えて光を拡散させる光源と、光を避けるタートルを持つシンプルなプログラムをレイアウトする必要があります。NetLogo:カメに1色の色合いを認識させるには?
これは、基本的な 'set pcolor yellow'を使用し、 'patch-ahead [pcolor] = yellow [right 45] [fd speed]'コマンドの場合に使用できます。しかし、これは私に拡散光を与えません。
HeatBugsコードを適用することで、ソースパッチを越えて色を拡散させることができますが、ローミングカメはもはや色が黄色であるとは認識しません。コードを!=黒に設定しようとしましたが、これも機能しません。私はそれがパッチが各チックの後にrecoloredされているためだと仮定しています。
拡散した色のパッチを避けるために、亀に認識させる方法はありますか?または、光を拡散する簡単な方法。 (私はさまざまな強さのために隣人と黄色-1を使用していませんので、それをしません)
これは私がこれまで持っているコードです:
globals [ color-by-unhappiness? ]
turtles-own[
speed
speed-limit
speed-min
ideal-temp ;; The temperature I want to be at
output-heat ;; How much heat I emit per time step
unhappiness ;; The magnitude of the difference between my ideal
;; temperature and the actual current temperature here
]
patches-own[
temp
]
to setup
clear-all
setup-turtles
;;creating diffused light
set color-by-unhappiness? false ;; button
ask n-of number-of-lights patches [
sprout 1 [
set color white
set shape "circle"
set ideal-temp min-ideal-temp + random (max-ideal-temp - min- ideal-temp) ;;these are all sliders
set output-heat min-output-heat + random (max-output-heat - min- output-heat) ;;these are all sliders
set unhappiness abs (ideal-temp - temp) ;;ideal-temp is a button
color-by-ideal-temp
set size 2
]
]
reset-ticks
end
to setup-turtles
create-fears number-of-fears [
set color violet
set shape "circle"
setxy random-xcor random-ycor
set speed 0.1 + random-float 0.9
set speed-limit 1
set speed-min 0.00
]
end
to go
ask turtles [
if speed > speed-limit [set speed speed-limit]
fd speed
ask fears[
if patch-ahead 1 = nobody [rt 135]
if patch-right-and-ahead 45 1 != nobody and [pcolor] of patch-right-and-ahead 45 1 != black[left 45]
if patch-left-and-ahead 45 1 != nobody and [pcolor] of patch-left-and-ahead 45 1 != black[right 45]
ifelse [pcolor] of patch-here = yellow [set speed speed-min][fd speed]
]
if not any? turtles [ stop ]
;; diffuse heat through world
diffuse temp diffusion-rate
ask patches [ set temp temp * (1 - evaporation-rate) ]
ask turtles [ set temp temp + output-heat ask bugs [bug-move patch-here]]
recolor-turtles
recolor-patches
tick
end
to recolor-patches
ask patches [ set pcolor scale-color yellow temp 0 150 ]
]
end
http://ccl.northwestern.edu/netlogo/docs/dictionary.html#shade-of:ちょうどここで期待通りの動きが機能するように(0)黒に自分の色を設定すること
pcolor
でパッチを頼みます –