English 中文(简体)
netlogo runtime error turtles on
原标题:

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.

问题回答

It could be that there is no patch-ahead q because the turtle is at the edge of world, facing towards the outside, and your would does not wrap around. The turtle has reached the end of the world and is facing the abyss.

Try setting the world so that it wraps around on both the x and y axis.

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

works, as does

 if can-move? q and any? turtles-on patch-ahead q
   [ some commands ]




相关问题
Collision Detection between Accelerating Spheres

I am writing a physics engine/simulator which incorporates 3D space flight, planetary/stellar gravitation, ship thrust and relativistic effects. So far, it is going very well, however, one thing that ...

Terrarium-like agent interaction framework

I m looking for a framework for agent interaction simulation, where I can deploy some agents and let them interact and watch their evolution. Until now I found Terrarium 2.0 (http://terrarium2....

coachable players for RoboCup Soccer Simulator 2d v14

I am doing a work similar to this one but the coachable players i found online are 3 years old and don t work with the latest version of the soccer server. does anyone know any alternatives? or have ...

3D Engine for Driving Simulation [closed]

Is there any open-source 3D graphics and physics engine specialized in driving simulation? Something like a configurable game engine targeted at games that involve driving, or something more ...

热门标签