I guess you want a loop with adjacent connection here? (so using also the diagonal?)
For the empty site in the loop detected, that's a bug I am going to fix it.
12-14-2020, 06:38 PM (This post was last modified: 12-14-2020, 07:20 PM by Michael.)
Thanks! Seems like there's still an issue, though. This black loop is not detected.. Shouldn't it?
Edit: It seems it doesn't count loops around enemy pieces if not all sites inside the loop are occupied på the enemy. Is this intended? If so, how do I detect loops around at least one piece belonging to the other player?
Yes you get it yourself. All the sites have to be of the types of the surrounding ones. No mechanism is implemented to count the number of each type in them. I can probably implement that but I have to check if the current code can do that and also we have to decide for a syntax for that.
I should probably mention that this game also needs to be able to detect whether there is a piece of the same color as the loop inside the loop that is not orthogonally adjacent to a piece belonging to the loop.
I can send examples when I get time with my computer. Here is a (uncomputable) definition in the meantime:
If we think of the playing area as an infinite group of orthognally connected empty sites, a piece is inside a loop if it is not part of a unicolored orthogonally connected group that includes a piece that is adjacent to an empty site belonging to an infinite orthognally connected group of empty sites :)
Or slightly differently put: A piece is inside a loop if you can't trace a unicolored orthogonal path from it to a piece orthogonally adjacent to an empty site belonging to an infinite orthogonally connected group of empty sites.
We discussed about your issue and we decide to add a ludeme (sites Loop ...) to return all the sites inside the loop or all the sites making the loop (according to a parameter). With that, you should be able to make any test you want on them.