How to change light breed colour in Netlogo - netlogo

I am currently trying to remodel the town and traffic crowd simulation found here to support self driving AI cars, which can be found here.
What I am currently stuck is is when the traffic lights where by the lights go from red straight to green, I want to add the yellow color into the simulation so the lights go from red, then to yellow then to green this is what i have but it just seems to freeze on yellow.
Please any help would be helpful, thanks.

I have below reformatted your control-traffic-lights code
to control-traffic-lights
if ticks mod (100) = 0
[ change-color lightsR ; red to yellow; others to red
change-color lightsL ; red to yellow; others to red
change-color lightsU ; red to yellow; others to red
change-color lightsD ; red to yellow; others to red
yellow-color lightsR ; yellow to green; others to yellow
yellow-color lightsL ; yellow to green; others to yellow
yellow-color lightsU ; yellow to green; others to yellow
yellow-color lightsD ; yellow to green; others to yellow
]
end
Imagine that you hit a relevant tick (every 100), start with the lightsR - any that are red get turned yellow on the first line, the get turned green on the fifth line. If they are any colour other than red on entry, they get turned red on the first line and yellow on the fifth line.
All four breeds of lights are going through the same logic. That is, the yellow-color procedure is being immediately applied to the lights based on the colour that they exit the change-color procedure.
UPDATE: I didn't make any changes to your code, I just formatted it so that it was readable to try to explain your logic issue.
If they enter as red, they get changed to green (via yellow)
If they enter as yellow, they exit as yellow (via red)
If they enter as green, they exit as yellow (via red)
What you need to do is change when the yellow-color procedure runs, so it's a few ticks later than the other colour change rather than in the same tick.
Try changing the second if ticks mod (100) = 0 [yellow-color l ...] to if ticks > 10 and ticks mod (105) = 0 [yellow-color l ...]

Related

What different breakpoint background colors mean in Eclipse?

When I execute to a certain line of code in eclipse the background color of this line turns green. But sometimes it is a different green (light green). What does that mean?
I think following is the reason:
Green : The debugger is at that particular line at current instance
Light Green : The debugger control would come at this line once it moves past current line
Explanation with Example:
I have run some sample program(DBTest.java) in Debug mode,
Green: Current debug pointer is at line 42, hence its colour is green.
Light Green: If you at this point click on line 25 pointer it will be Light Green because control after line 42 is going to line 25.

AuthotKey: Colour detection issue

I have a script which shows different messages depending on if a particular shade of red or green colours are detected, at set screen coordinates. The green detection is working fine, but the red detection is not working.
The script searches the specified x and y coordinate area which is set as: x1, y1, x2, y2.
Scripts seen below.
The hex colour for the green shade is #32CD32, and for red it SEEMS to be #FF0000 (both determined by hovering over the image using Active Window Spy).
Red text screenshot:
[![Red text to be detected][1]][1]
Green text screenshot:
[![Green text that is already successfully detected][2]][2]
My script is detecting green (#32CD32) perfectly. It will NOT detect the red colour #FF0000. I have tried many different variations of the red colour, and still cannot get the script to recognize it when it is on screen. Does anyone know how I can solve this?
This second script to detect RED does not work (note that the coordinates for both scripts aren't the same- the two colours are in different places on the screen):
^t::
Am I making a mistake with the hex colour of the red text? I know that the method overall works fine for green, so it should be straightforward for red.
This code searches the specified rectangle on the screen for a red pixel:
PixelSearch, Px, Py, 121, 282, 169, 310, 0xFF0000, 3, Fast RGB
AutoHotKey expects colors to be specified using a Blue-Green-Red (BGR) format unless you specify the RGB parameter. See the documentation for PixelSearch

netlogo change color of a link line

The color of a link line seems to be gray how could I change it? (global?)
I searched already at the netlogo dict http://ccl.northwestern.edu/netlogo/docs/dictionary.html but didn't found anything about it.
color is a built-in variable of links just as it is the case for turtles, see here.
So this will change the color for all links:
ask links [set color red]

Find the recurrence relation

I'm new to recurrence relations and I'm having trouble figuring out this problem:
Find a recurrence relation for the number of ways to make a stack of green, yellow, and orange napkins so that no two green napkins are next to each other.
I've come up with a(n)=2a(n-1)+2a(n-2) but I'm not sure if that's right/ on the right track.
Any help would be great!
First of all, your answer is correct:
If the n'th napkin are green then n-1'th napkin could be yellow or orange and other n-2 napkin could be anything so it is 2*an-2.
If n'th napkin is not green it could be yellow or orange and other n-1 napkin could be anything so it is 2*an-1.
So the final answer is an = 2*an-2 + 2*an-1.

What do the colours mean in the TortoiseGit log window?

What do the red and flesh coloured bars represent?
From the TortoiseGit source for Colors.cpp:
CurrentBranch: Red
LocalBranch: Green
RemoteBranch: Peach
Tag: Yellow
Stash: Gray
The colors of the branch lines on the left aren't significant and don't correspond to the branch bar colors:
BranchLine1: Black
BranchLine2: Red
BranchLine3: Green
BranchLine4: Blue
BranchLine5: Gray
BranchLine6: Olive
BranchLine7: Teal
BranchLine8: Purple
If you are talking about the log dialog:
the red are the local current branches
the flesh ones are the remote branches
the green ones are for tags non-current local branches
the yellow ones are for tags
Oran's answer (upvoted) has the complete list of color codes.
New marker: bisect
bisect good: blue
bisect bad: red (lighter)
The question and answers are for a very old version of TortoiseGit.
Never version (>= 2.0) do not only have different colors, but also different shapes for indicating local branches, remote branches, remote tracking branches, stash, bisect refs, etc. (cf. https://stackoverflow.com/a/61266764/3906760).
The current default colors are:
CurrentBranch: Dark Red (two different shapes)
LocalBranch: Green (two different shapes)
RemoteBranch: Peach (two different shapes)
Tag: Yellow (two different shapes)
Stash: Gray
Bisect Bad: Light Red
Bisect Good: Blue
Bisect Skip: Grey
The color of the commit graph does not correspondent to the colors of the shapes. THe line color is just there to make the graph better readable.
Some of the colors are configurable: https://tortoisegit.org/docs/tortoisegit/tgit-dug-settings.html#tgit-dug-settings-colours2