02-22-2021, 12:04 PM
The condition on the if is a condition to include or not some elements of each group found. Each site can be iterated in it with (to).
Then in your example with the XXX you can apply whatever the move you want but with (sites) you can iterate all the sites of each group.
For example in the following example, you get all the group composed of Yellow pieces owned by P1, then on each element of these groups you set the state of these sites to 2.
Regards,
Eric
Then in your example with the XXX you can apply whatever the move you want but with (sites) you can iterate all the sites of each group.
For example in the following example, you get all the group composed of Yellow pieces owned by P1, then on each element of these groups you set the state of these sites to 2.
Code:
(forEach
Group
Cell
Adjacent
if:(= (id "Yellow" P1) (what at:(to))
(forEach Site (sites) (set State at:(site) 2))
)
Regards,
Eric