user9182769
user9182769

Reputation:

Netlogo in-radius from point

For an assignment, I need to compute a path from A to B, where some patches are red, which means they are obstacles.

A robot walks 1 step forward towards the goal, but I need to check for obstacles. I (among others) like to check if there are such obstacle patches half way between the robots starting point and endpoint (of one single step). So far, I have been using forward 1 / 2, and then in-radius. However, I am not allowed to move the robot first.

Thus, I need to find a method, similar to in-radius. Unfortunately, in-radius only works from an agentset, which I am not allowed to move.

Anyone knows a trick around this or a method in netlogo which I missed?

Help is greatly appreciated, thanks in advance!

Upvotes: 0

Views: 518

Answers (1)

StephenGuerin
StephenGuerin

Reputation: 871

Assuming "goal" is a turtle property, you can get the patch halfway between a turtle and its goal with:

patch-at-heading-and-distance towards goal (distance goal / 2)

Upvotes: 1

Related Questions