Trying to set different colors on patches based on their coordinates

59 Views Asked by At

I want my patches to be have different attributes , and color, based on their coordinates. My end goal is to represent the gutwall with grey and the lumus with pink so i have used for loop to implement it in The userPatch

        def i=0
        for(i;i<=32;i++) {
        i++
        if(distance(patch(i,32))==0) {
                Gutwall()}
        else {
        Gutlummus() }
        if(i<=32) {
            continue
        }
        }}

But it only appears to do the if statement for i=0

1

There are 1 best solutions below

0
On

You wouldn't need to iterate through the patches since the UserPatch represents each individual patch. You would just need to check that the patch is the target patch. It might also help to familiarize yourself with Groovy syntax, e.g., for for loops: https://groovy-lang.org/semantics.html#_looping_structures