答案 0 :(得分:2)
以下是我的看法:
patches-own [ n ]
to setup
clear-all
resize-world -4 4 -4 4 ; so it looks better, but use any size you like...
create-turtles 1 [
set heading 180
foreach n-values count patches [ ? + 1 ] [
set n ?
if [ n = 0 ] of patch-left-and-ahead 90 1 [ left 90 ]
fd 1
]
die
]
ask patches [ set plabel n ]
end
答案 1 :(得分:1)
有趣的是你应该问我早上也做了同样的事情。有一个函数使用floor函数,但我记得这是netlogo 所以我做了一只乌龟为我做了。
使用此程序
to spin
let k 1
set t t + 1
repeat 2
[
lt 90
repeat t [fd 1 ask patch-here [set n k set k k + 1]]
]
end
这个代码在启动时。
crt 1 [
set heading 0
repeat 41 [spin]
die
]
当然
patches-own [n]
按顺序调用它们
foreach sort-on [n] patches ask ? [ "the stuff you want them to do" ]