Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.


+11 votes

Im looking to make something like a 10x10x10 cube of patches a different color rather than the whole thing

asked in CSC 150 January201920 by (8 points)

You could always use different breeds as well.

2 Answers

+4 votes
Best answer

To set certain patches color with ticks, I think you need to add more conditions to your if statement. For example, this code will change color of patches in the corner if ticks are bigger than 500,

ask patches [
if (ticks > 500) and (pxcor > 5) and (pycor > 5) and (pzcor > 5)[
set pcolor 12 + random 16

Hope this helps.

answered by (8 points)
selected by

Thank you this is exactly what I was going for, I appreciate it.

+4 votes

if you know the coordinates of the patches, you can use if statements ti just turn those patches to different color

answered by (2.3k points)

lmk if you need more help, I would be happy to do it


so I want the patches to only change after a certain number of ticks like so :

ask patches [
    if ticks > 500 [set pcolor 12 + random 16]
    if ticks > 550 [ set pcolor black]

I think I understand now how to set certain patches colors with the if command, but with the ticks I dont know how to do this.