I tried your first option, but could make it work...
This is contexte:
The squares represent territories, the yellow ones have the variable ''Unowned'' and the reds ''Owned'' but they all have the variable ''Adjacent''. So if a yellow square touch the red (owned) ones the ''adjacent'' variable would change to 1 (meaning it's touching) and then if its equal 1 I change the colour of those touching.
So I need to know how to change the variable ''adjacent'' of the unowned squares in dirrect contact with the reds.