1

while running the following code

if any? (turtles-on patch-ahead q) [ some commands ]

where q is a number variable

there is a run time error saying: turtles-on expected the input to be agent or agent set but got nothing.

what can be wrong.

4

2 に答える 2

1
 let p patch-ahead q
 if p != nobody and any? turtles-on p
   [ some commands ]

動作するように、動作します

 if can-move? q and any? turtles-on patch-ahead q
   [ some commands ]
于 2010-10-18T14:55:44.560 に答える
1

patch-ahead qタートルが世界の端にあり、外側を向いていて、あなたの意志が包み込んでいないため、ない可能性があります。カメは世界の果てに到達し、深淵に直面しています。

x 軸と y 軸の両方でラップするようにワールドを設定してみてください。

于 2010-08-26T10:31:09.313 に答える