English 中文(简体)
netlogo programing help on traffic simulation
原标题:

I am trying to find if there is a turtle on patch-ahead n

whose speed - acceleration is <= 0. The code I came up with is:

if any? turtles on patch-ahead n with [speed <= (speed - acceleration)]

but this gives an error that:

patch-ahead expects a number, instead got agent set.

How do I remedy this?

n is a number variable. I want to access the turtle s speed , which is a user defined turtle-own variable, at the nth patch from the calling turtle. The command with doesn t work here. Please suggest an alternative to access the speed of the turtle at, say, the 3rd patch from the calling turtle.

最佳回答

If you look at the patch-ahead documentation you will notice that it does require one argument: a number representing the distance to look ahead. You are using a patch n instead of a number.

As per you comment, I think maybe you want turtles-on, and use parenthesis to make it clearer, as such:

if any? ((turtles-on patch-ahead n) with [speed <= (speed - aceleration)])

In the above I am assuming that n is a number: the distance you want to look ahead.

问题回答

暂无回答




相关问题
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 ...

热门标签