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.

Categories

+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 (1 point)
+2

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 (1 point)
selected by
+3

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 (1 point)
+3

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

+3

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.

...