Giorgio
Giorgio

Reputation: 13

Netlogo: How to set different colors to turtles?

A quick question:

How to set every turtles different colors?

Like, I'd to set the random color whose value ends in *6 or *3 to turtles.

My code:

ask  turtles [set color ((random 14) * 10 + 6 ) or ((random 14) * 10 + 3 ))]

But it doesn't work. Since the or here is wrong.

Is there any other methods express or here?

I appreciate any kinds of help! Thank you!

Upvotes: 1

Views: 414

Answers (1)

JenB
JenB

Reputation: 17678

or is a logical test. What you want is to assign one-of those values. I think this is what you want:

ask  turtles
[ set color one-of (list ((random 14) * 10 + 6 ) ((random 14) * 10 + 3 )) ) 
]

Upvotes: 2

Related Questions