09-06-2020, 01:34 PM
(09-06-2020, 09:28 AM)Eric Piette Wrote: Ok so I guess if you know the number of pieces you have to place before to play your first move, you should be able to check each empty sites with a (forEach Site ...) ludeme and use a condition on each of these sites according to the number of empty sites belonging to a group starting from that site.Thank you! I hope you don't feel pressured to spend your time off on this. I'm patient.
With your example with 2 pieces to place and the site surrounded by pieces.
In checking each site in (sites Empty) if we look the size of the group of empty sites starting for each site and keep only the sites that will be equal or more than 2 except for the site surrounded by pieces.
Consequently something like
(move Add (forEach Site (sites Empty) if:(<= 2 (count Sites in:(sites Group (site) if:(is Empty (to)))))))
can work.
…
And by the way, sorry for that delay to answer to you, I officially come back from holidays tomorrow :)
If I understand your suggestion correctly it assumes that the groups may be placed on any empty cell, so it happens to not generalize to my actual problem. Here's an example where it breaks down: Take the trivial game I described where you place a group of size 2 every turn, but now add the restriction that groups may not be orthogonally adjacent to each other. Then we can end up in a position like this:
![[Image: pic5641150.png]](https://cf.geekdo-images.com/imagepage/img/snY-9x9Xuh6zKPQjjliMourDoQo=/fit-in/900x600/filters:no_upscale():strip_icc()/pic5641150.png)
The center cell belongs to a group of 41 empty cells, but it should still be illegal to place there because it would be impossible to place the entire size-two-group there without violating the restriction that groups may not be orthogonally adjacent.