turtles-own
4 Z1 Z8 i, u: q0 C" I! J9 |to setup
! j/ z. W+ ?1 K( w+ { clear-all& P" p, x1 o* `% F/ y
create-turtles 100
1 E# C) c6 B! i" x7 r9 o ask turtles [setxy random-xcor random-ycor]) k+ O [/ G' u% I: `3 @
end# J" h' G8 h5 K
' S+ h& y6 h5 U5 `: p: p# {
to go3 q; |0 X- w& N& D) s" ^) J
ask turtles
, Q/ ^( z2 N3 u [ right random 360 forward 1]+ Z8 } J r/ x' g( w, O( W
run-a-turtle
( G" |% @; s: K5 M) L q$ A8 vend 8 d8 A3 Z4 f% e$ i6 H
% `- f8 E7 I) f6 n- B; C
to run-a-turtle; d! T0 `1 P7 ~% `
ask turtle i [set color red
5 C0 C% x% W* Y9 \, k# w! [ set i i + 1 ]* e/ t( D0 A+ X7 r6 E+ X9 N, Z
ifelse i >= 99 [stop]
$ c5 S; B& `/ T9 r [run-a-turtle]4 ]4 E3 f4 a( O
end
7 ?( x. x1 R2 ~6 _4 n( g: s9 z, o 我这个程序就是运行不起,我想随机create100个turtles,然后,让turtles一个一个的变红,这里我用了一个循环,而且一个一个叫turtle变红,我就是用的ask turtle i.
, u4 |* [( o$ @% c0 n最近我都在自己学这个语言,有很多不精的地方,这个程序就是通不过,谁能帮忙看看啊,万分感谢!!!!! |