このビデオと同じ種類の線に沿ってシミュレーションを作成しようとしています (1:29 - 1:45)
https://www.youtube.com/watch?v=pqBSNAOsMDc
タートルを 0,0 に向けてから、半径 90 の空のパッチを探すことで、無限に円を描くプロセスを実現する簡単な方法を考えました (したがって、タートルは常に右を向いています。
エラーコードを取得しました..
'点 (3,-6) からその同じ点までの見出しは定義されていません。'
誰かが私のコードで正しい方向に私を向けることができますか?
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
turtles-own [ faction ]
to setup
clear-all
ask patches [ set pcolor white ]
set-patch-size 7
resize-world min-pxcor max-pxcor min-pycor max-pycor
ask patch 0 0
[ ask patches in-radius ( max-pxcor * .6) with [ random-float 100 < density ]
[ sprout 1
[
set shape "circle"
assign-factions
set color faction-color
set size 1 ] ] ]
ask turtles-on patch 0 0 [ die ]
reset-ticks
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
to-report faction-color
report red + faction * 30
end
to assign-factions
let angle 360 / factions
foreach n-values factions [?] [
ask patch 0 0 [
sprout 1 [
set heading ? * angle
ask turtles in-cone max-pxcor angle [ set faction ? + 1 ]
die ] ] ]
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
to go
ask turtles
[ set heading (towards patch-at 0 0) ; adjusts heading to point to centre
let empty-patches neighbors with [not any? turtles-here]
if any? empty-patches in-radius 90
[ let target one-of empty-patches
face target
move-to target ]
]
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;