Computing an agent on the further ends of cone of vision

The wall(grey agents) are in a constant place along the top of the world.

The blue agents always directly below but at various distances. But they be off to the side of the gap but nevertheless can be rotated so that they face the gap.

That the cone of vision angle is same for all blue turtles.

In the above figures, the blue agent's cone of vision is depicted. I wish to calculate the grey wall which meet the ends of the cone of vision ,that is, one on right and one on left.Also could I somehow calculate the x-coordinate at that point. Not the grey agent's coordinate as that would be a approximation.

To Compute:

The x coordinates where the extremes of cone of vision intersect grey turtles. Or those grey turtles they intersect.

Rough Figure:

So I wish to compute x_1 and x_2 in the below figure. One way could as suggested by @JenB to divide it into three cases and and calculate A in each case.(Primarily on left or right). Then use trigonometry. I am correct. Are there any other ways as well?

Best How To :

The following trigonometry approach(suggested by @JenB) works perfect:

I believe you can modify my example to match your problem, in summary I first read the file into a global list, extracted the number of agents, assigned properties of agents at each tick and ran the simulation: extensions [csv] Breed [Drivers Driver] turtles-own[ Name List-Of-Actions ] globals [li] to...

I managed to answer my question with this code: world = (World) cntxt.getAgent().world(); // in my case, I start with a network empirical = readNetwork(new File(filename)); AgentSet agentset = new org.nlogo.agent.ArrayAgentSet(Turtle.class, Manager.empirical.getVertexCount(), false, Manager.world); AgentSet breed = Manager.world.turtles(); // add a turtle for every node that I have in the...

link-neighbor? will tell you that. It's a turtle reporter and it takes one argument; the turtle that you are want to know if it is connected to. So: ask n-of number-of-links turtles [create-link-with one-of other turtles with [not link-neighbor? myself]] will do the trick. Keep in mind that this will...

A few options: one-of [ true false ] random 2 = 1 random-float 1 < 0.5 - If you need to modify the probability, to get any Bernoulli distribution you want If I deal with a lot of probabilistic stuff in a model, I like to add to-report probability [...

I think screen-size-x and screen-size-y are NetLogo history. You can use max-pxcor, max-pycor and min-pxcor, min-pycor to get the world borders or world-width and world-height to get just the size. To get a random position there are random-xcor and random-ycor. to setup-turtles setxy random-xcor random-ycor end ...

So you've made a slider with a global variable size-of-turtle. Do you have a procedure that will actually tell the turtles to do what you ask? And yes, please show your error message. If you have a slider that nothing refers to, nothing will happen when you change the values...

There is no release for the extension yet. The zip file that you downloaded is just the source code and doesn't contain the compiled JAR files that you need to use the extension with NetLogo. If you want to try it out, you will have to build it yourself. For...

If you want to model relations between agents, NetLogo has the perfect thing for that: links! Having each turtle assign a score to all other turtles can be quite naturally expressed as: directed-link-breed [ rankings ranking ] rankings-own [ score ] to setup clear-all create-turtles 10 ask turtles [ create-rankings-to...

What directory are you running that command from? For NetLogo to find extensions, sample models, etc., the current working directory at startup time must be the NetLogo directory. So your script should chdir there first.

The problem in your code is this expression (and you must have changed it, because it doesn't compile): [pcolor] n-of 2 neighbors4 = grey n-of 2 neighbors4 returns an agentset consisting of two randomly chosen patches of the four neighbors. In order to get a list of its colors, you...

You can, but it is almost surely the wrong approach. (For one thing, the names will not be global unless you declare them all ahead of time.) Instead, use the table extension, create a global to hold your table, and use the table to map your id numbers to your...

There is no such known problem. If you think you've found a bug, please open a ticket at https://github.com/NetLogo/NetLogo/issues/new and include a SSCCE. (The above code is not self-contained — you don't include the necessary declarations, and you don't include the code you used to test and reproduce the bug...

Here's how I'd do it: Make sure your turtles are all of one breed, say, particles, or whatever they represent. Create another turtles breed called vectors or something. These turtles are going to be the tip of your vectors but you'll use links to actually visualize the vectors. Now, you...

That NetLogo code looks fine and is exactly the same syntax that I have successfully used in my project. One possibility is that the problem is with the format of the .asc data, it may have been corrupted. Try opening the .asc dataset with a text editor and check that...

I tried your code. First I used the catchment-area as a global variable and the world behave as you specified, then I tried to set the catchment area as an own of every single patch so that every single patch has one associated: patches-own[ catchment-area ] So now using the...

This is quick and dirty, but find-dup should return the first duplicated item (in this case a sublist) in the list. to go let listA [[-9 2] [-9 1] [-9 0][-9 -1][-9 -2][-9 -3][-9 -4][-8 0][-9 0]] show find-dup listA end to-report find-dup [ c ] ;returns the first duplicated...

I would suggest moving the unwanted interface items to the edge of the Interface tab, recording the movie, then cropping the movie in movie-editing software to remove the unwanted portion. Alternatively, you could cover the unwanted interface items with one or more opaque white notes, or cover them with other...

This should be simple enough if you use BehaviorSpace. In your experiment definition, put score in the Measure runs using these reporters textbox and uncheck Measure run at every step. When you run your experiment, save your results using Table output. It will produce a csv that you can open...

Maybe you can make use of one-of and some filters on agensets using with. Probably they will facilitate your work and makes clear your intentions. Buyers-own [dPrice MadeNewTrade?] Sellers-own [dPrice MadeNewTrade?] to Test ask Buyers [ let dBuyPrice dPrice let SellersTrade Sellers with [MadeNewTrade? = false and dBuyPrice >= dPrice]...

It works as designed. The documentation of path primitives says: If no path exist between the source and the target turtles, all primitives will report an empty list. On the other hand, distance primitives will report false if no path exists. As per the documentation: Finds the shortest path to...

Instead of using variables for this, you should define a reporter: to-report x report 2 * y end though, for the sake of those reading your code and for your future self looking back at your code, use more descriptive variable names than x and y :)...

Check out every. It makes sure the given command block runs at most once per time period. Anyway, if your go is being run by a forever button, then this should work: to go every 30 * 60 [ get-data execute-and-return-decision-based-on-the-data-just-retrieved ] end ...

Alan's solution is good if you want age to be equal to the number of ticks since a turtle was created. You can divide that number by another number if you want a different measure of age. For example, if ticks represent months, you can divide by 12 to get...

There are two problems here. One is that create-links-with is wrong because one-of returns a single agent, not an agentset. You need create-link-with. But the main problem is with this part: other turtles with-min [...] NetLogo understands this as other (turtles with-min [...]). This reports an empty agentset, because the...

You can use the NetLogo web extension to get real time information from any stock price API. Looks like Yahoo has a pretty simple API. To use their API to, for example, get Google's latest stock price, you'd do something like: web:make-request "http://download.finance.yahoo.com/d/quotes.csv" "GET" [["s" "GOOG"] ["f" "l1"] ["e" ".csv"]]...

Good question! You can generate either list from the other, but I think turtle-path to link-path is easier: ;; Construct the turtle path, putting the current turtle on the front: let turtle-path fput self nw:turtles-on-weight-path-to turtle 3 "weight" ;; Iterate through pairs of turtles, getting the link connecting them let...

You didn´t use quotes in your histogram list, but I am assuming that you wanted to plot a list of strings like ["a" "b" "c" ...], right? As far as I know, it is not possible to use categorical values (like strings) for a histogram in netlogo plots. This is...

If I have understood what you want, this will work globals [radius] to setup clear-all create-turtles 50 [setxy random-xcor random-ycor] set radius 5 connect end to connect ask turtles [ ask other turtles in-radius radius [ create-link-from myself ] ] end The problem is that you have ask turtles in-radius...

It has to do with the timing of side effects in your program. Suppose that the very first turtle to move moves near the center. None of the other turtles have moved yet, so they're all still on patch 0 0 and set my-neighbors (other turtles) in-radius 3 will capture...

This is a lot of code to ask anybody to debug for you. I would suggest solving a simpler version of the problem first. Do you have code that can create wall-agents turtles in a single patch, evenly spaced along a line? Once you had a working code that did...

Instead of asking 4 neighbors, ask min list 4 count neighbors: ask n-of (min list 4 count neighbors) neighbors [ ... ] But from the model point of view, there will be different redistribution on the edge of the table, so this is not a good idea. Maybe it is...