so now we have the uh turtles getting
the rewards appropriately at least we're
pretty confident of that um but we don't
really see that at all in the model
representation right uh and the only way
so we could let it run for a while right
we could set up and go and then we could
you know
inspect each turtle
and see what its reward was um and then
see if it was doing a good job and
figure out what its strategies were what
its best strategy that was using was and
all that kind of stuff um but you know
and so this this Turtle for instance has
got an eight reward out of 26 ticks
maybe that's good who knows right so
maybe a better way to think of this
might be to change the color of the
agents the turtles as they increase
their rewards so that we can quickly
identify y those Turtles who are doing
better at going when the uh bar is not
so crowded so let's go back to the code
again um and we're going to look at when
uh they uh when they decide to actually
attend the bar or not and then at that
point right we can
actually modify their color at roughly
the same time because this is going to
apply to all uh the Turtles based upon
the amount of reward they currently have
so um we can set their color and of
course how do we want to do this now we
want to do it in such a way so it's
somehow scaled well it turns out there's
a nice net logo command called scale
color that we'll talk about and you know
whenever I'm trying to figure out like
so scale color is a command I don't use
very often in that logo um so if I'm
curious about it uh one nice thing you
can do is you can actually just put your
cursor somewhere on the word um and uh
if you control click you can go to Quick
help and that will pick up the net logo
scale color definition right um and if
you want to do it a different way you
can actually just put your cursor on
there and if you don't want to do the
control click or right click you can
just go to help um and then hit look up
in dictionary and there you go so scale
color as you can see right gives you
takes a number
um a a color a number a range um and the
the minimum and maximum basically of
that range right so the example here is
Ash Turtles set color scale color red
age 050 which will color each Turtle a
shade of red proportional to its value
of age so we want to do something
similar so let's think about this so
let's say we want to do a color of red
um and we want to do it based upon
reward right which is our variable of
interest um and what we can do is we can
start it based upon the max
reward of all turtles so that's going to
be upper value of our range and we'll
say plus one just to kind of so that
there's some leeway at the top right and
then we can put the minimum value at
zero right um and this is very similar
and we should probably add a note in
right scale the color on the basis of
reward okay so now we need to test to
see if our new scale color code is
working correctly uh so we can let the
model run a bit and as you can see we do
get different colored individuals and
since we set it up so that um it was
going to Scale based upon the Max uh to
the lowest value what that's going to
mean is that the lightest uh colored
Turtles are going to be the ones with
the most reward and the um sorry the
lightest colored ones are going to be
the ones with the least reward and the
darkest colored ones will be the ones
with the most reward so in fact if we go
look at Turtle 86 here who's a a very
light colored Turtle right we get that
they have a reward of one actually this
one seems to have a reward of one you
can tell it has a little bit of color to
it probably the one above it has no
reward at all because it was pure white
as far as I could tell yep in fact no
reward at all and we can go to one of
these ones that's actually in the bar
that has a pretty dark
color and we can see that yes in fact
they have 22 reward right out of 26
steps so that's turtle is doing very
good at attending when the bar is not
crowded um so that gives you some idea
that the code is actually working um
let's talk I want to talk a little bit
about how Color Works in that Lo logo uh
in the next lecture and talk a little
bit why visualization is important in
this space okay so I want to talk a
little bit about how Color Works in net
logo to help you understand the scale
color command a little bit better so uh
if you go up to tools and then go up to
color swatches um you'll actually see
the um the all the colors that are
possible to represent in that logo and
the defaults showing you at one interval
so this is 45 this is 46 uh but you can
go all the way down to like 0.1
increments and get really detailed
colors just so you know right um and so
the way that logo works is that each
major color say gray or red or blue or
whatever has a number associated with it
so green in net logo is a reserved word
that means 55 and 55 is this color right
here right um and so I can choose any
particular color and I can get the exact
um uh version of that in terms so sky is
95 minus 2 gives me this slightly darker
uh Blue version of the sky color right
um and it also works that all the
numbers end in zero are going to be
black and all the numbers end in 0.9 are
going to be white um and then you have
the gradations in between um so that's
how uh Nal color works so if you you
know one quick thing if you want to just
play around of colors you can choose one
of these pick the color and it will give
you the color right here and then you
can just write set color cyan plus 2 and
it'll set that to that color so the way
scale Color Works is that essentially
you choose a base color or a base number
and then it scales from black to white
around uh That Base color uh providing
you with the gradiation so we chose red
and so then what it did uh was it gave
uh the lowest performing individuals A A
Whiter color in the dark in the in the
best performing individuals a darker
color um so that allows you to just
scale between the two right so uh but
why is visualization important why
should we even worry about these colors
let's think about that for a second okay
so if you want to explore uh color and
the relationship between color names and
numbers in that logo I highly recommend
playing around with the color swatches
tool it provides a very convenient way
to look into some of those things um and
what's important to realize is that when
we were uh modifying the color based
upon the reward that an agent had we
weren't actually modifying the color the
color was red no matter what what we
were doing was modifying the intensity
of that color um which is sometimes in
the visualization literature referred to
as the value of the color or the value
of the shade right um and bertan and
tufty and several other visualization
researchers have shown that value is a
powerful way uh to represent ordinal
data in other words data where we can
think about the order of them in our
case for the reward we can think about
that this person has more reward than
that person right and so then we can
quickly look and we can say oh these
these individuals who are have a darker
value they are get doing better at the
al bar problem than the ones who have a
lighter value and I would argue that it
even gives you some insight into
quantitative data in fact in the one
case I was able to see that the one was
just maybe a shade darker right and so I
knew once I knew that that value of the
shade darker one was one the one that
was lighter had to be zero right and so
there's some uh insight into even
quantitative and not just ordinal data
that the value um that a value
characteristic gives us right color by
itself by the way couldn't easily be
used this right is red versus green is
one of them a higher value or or higher
um ordinal than another right but value
intensity does provide this with some
insight into this right um and so this
is an interesting case right this is
showing off the power of visualization
your insight into your model is useless
at least the terms of Education
policymaking things like that if you
can't convince others of that Insight
right and not everyone is a modeler so
they're not all going to be able to just
look at a bunch of numbers and figure
out what that means about the model
right they need to be able to see it and
to understand it and visual tools are
powerful ways to reach uh people to
educate people about what your model is
saying so I highly recommend spending
some time thinking about uh the
visualization of your agent based model
uh and in fact uh there's some good work
on this space and we'll talk some more
about visualization as we go forward
with this class so that's it for today
thank you very much