Need Help Removing Traces Left By Turtles In "pen-down" Mode - netlogo

I created a turtle and added "pen-down" to see how the turtle traveled and once the turtle stopped, it was hard to spot its final location with all the traces. I need help removing traces left by turtles in "pen-down" mode in order to see the turtles final location. I'd like to do this by pressing a button on the interface that removes the traces, however, I don't know the exact code to be able to do that.
Any help would be appreciated, thanks.

Sounds like you want clear-drawing, http://ccl.northwestern.edu/netlogo/docs/dictionary.html#clear-drawing.
But see also this similar question: How do I delete turtle pen lines in netlogo?

Related

Netlogo - Turtles crossing Line

i want to count the turtles which cross the line - i tried with "turtle on patch" but if the turtle stop it counts twice. If the turtle moves more then 1 patch it counts nothing...
any ideas? Thanks Peter
Line
From the picture you added it looks like you are running a single-lane traffic model with a very narrow "finish line" that turtles can cross entirely in one tick.
To catch crossings:
One thing you could do is make a thicker "line" on the far side of the finish line. Maybe make it 5 patches wide. You could color it yellow while you're testing, and change it to hidden when you're sure it is working. If a turtle is on that patch, it has crossed the line. If you make it wide enough it should be impossible to leap over at any speed. It should be easy to test using only one turtle and running the model slowly.
To count stopped cars:
Without seeing your code it's hard to tell why you are counting stopped cars twice. Can you post your code or the relevant section of it here? I'm guessing you have some global that you are incrementing each time you find a new stopped car.
It's less efficient, but much more reliable to let the cars own a variable like "stopped?" that you initialize to false and set to true when the car crosses the line. Then at any time you can get the accurate count of stopped cars with
count cars with [ stopped? = true ]
Assuming you have a variable called my-count of stopped cars, and you want to see when that goes wrong, you could insert a line of code like
if mycount != count cars with [stopped? = true] [user-message "count is wrong!"]
If the line is definitely going to be vertical (as in your diagram) then the easiest way may be simply to count the turtles with pxcor larger than whatever coordinate the line is at plus something for the car size.

Netlogo turtles move and angle

I want to move my turtles and I want that they don't go out of my field.
For example, If turtles 1 have to attack the goal that is in the right place of the screen, I don't want that the turtles 1 that is in the left side go out from the field and reappear on the right side(and viceversa).
I initial found a possibile solution by set the goal position, and use :
facexy-nowrap goal-xcor goal-ycor
But It doesn't help me because I use this command only for attack behavior, and I prefer to not use it...
So there is another solution? like using field lines?

How do I make linked turtles move together in NetLogo?

I'm trying to model fish movement and need them to form schools when there is more than 1 of the breed in a given patch. So far I have managed to get them to form links when they encounter each other with the function below, but then they continue moving independently. I'd also like to re-scale the color of turtles in a linked group so that the more turtles in the group the darker the color is (I'm guessing this is similar to the way you make contour maps according to environmental gradients but I haven't figured it out yet).
Any assistance is always appreciated!
to form_link
if count breed_1-here > 1
[
ask breed_1
[create-links-with other breed_1-here]]
end
If linking isn't the way to get them to move together, I'm fine with another method.

netlogo turtles moving on coordinates

I created turtles called "birds" that shall move on a specific route. The route is made out of links between turtles I called "rasts". As I couldn't find a way to make the turtles move from the first rast to the second, third, fourth and fifth, I changed the rasts an created them as patches.
So, now I have patches in red (rests).
How do I get the birds moving to exactly these patches and, when they are at the patch, how do I make them go to the next one?
I have no code at the moment, because I always hope to find the fault in my first model (see my other questions).
Is there anybody who knows how to solve my problem?
the move-to command moves your turtle to any other turtle or patch you specify. You can also use the face and forward commands to gradually move along a route (see the 'Move Towards Target' code example in the Models Library that comes with NetLogo)

How to give turtles directional commands when moving along a drawn out network?

I want turtles to be able to flow along the paths I have drawn out for them. To do this I think it might be a reasonable idea to have a list in the u.i that allows the user to select a preordained direction of movement for that patch so the turtles know how to flow along the network. Has anyone else produced a model with this feature? If so would it be possible to give an example of the relevant source code for implementation into my own project?
I did something a while back where each patch had a direction variable that turtles set their heading to when on the patch.
Something like
patches-own[dir]
to go
ask turtles [set heading dir fd .1]
end