Ludii Forum
(is Loop) not recognizing all loops - Printable Version

+- Ludii Forum (https://ludii.games/forums)
+-- Forum: Problems (https://ludii.games/forums/forumdisplay.php?fid=5)
+--- Forum: Grammar Problems (https://ludii.games/forums/forumdisplay.php?fid=24)
+--- Thread: (is Loop) not recognizing all loops (/showthread.php?tid=595)



(is Loop) not recognizing all loops - Michael - 06-06-2021

(is Loop) does not always detect it when a loop is formed. I have attached a simple example. I don't think the issue only affects shared pieces, but I don't have any trials to prove it.


RE: (is Loop) not recognizing all loops - Eric Piette - 06-07-2021

Hi,

The current implementation of (is Loop ...) is looking only for the colour of a specific player, so it does not look for shared pieces.
I will improve that later in the same time of the BooleanFunction I talked about in your other post.

Regards,
Eric


RE: (is Loop) not recognizing all loops - Michael - 06-07-2021

(06-07-2021, 07:04 AM)Eric Piette Wrote: (is Loop ...) is looking only for the colour of a specific player
This is not my experience.. Or, it also misses loops that are exclusively by one player. 

In the attached .lud both players place "Disc1". Still some loops go undetected. I tested whether this means that all the pieces in the loop must be placed by the same player, but that is also irrelevant. In "undetected loop 1.trl" the undetected loop contains Disc1-pieces placed by both players, but so does the detected loop. And in "undetected loop 2.trl" there is an undetected loop consisting of only Disc1 and one player placed all those pieces.


RE: (is Loop) not recognizing all loops - Eric Piette - 06-07-2021

Hi,

Unfortunately, when you use only (is Loop), the player placing the piece is relevant, because if you look at the documentation of (is Loop) when no colour has been specified the colour of the mover is taken. Consequently here, when P2 is playing, that ludeme is trying to find a loop with the pieces of P2.

To do what you want with the pieces of P1, you have to use (is Loop (id P1)). But the detection of Loop is working with the correct parameters.

However, I will improve that ludeme to be more generic like I said to you in my previous messages, so when I will do that, the description of (is Loop) is going to change anyway.

Regards,
Eric


RE: (is Loop) not recognizing all loops - Michael - 06-07-2021

Hm. I must be misunderstanding something, because I just showed you a detected loop that consists of pieces placed by both players. It sounds like you're saying that this should not have been detected.


RE: (is Loop) not recognizing all loops - Eric Piette - 06-07-2021

Hi,

The components on the loop are the only factor to detect a loop. However in your description, you use (is Loop) meaning you look for a loop with the pieces of the mover and starting from the last piece placed.
So when the player P1 is placing a piece which is closing a loop with the pieces of your example you detect it. And when P2 is playing you will never detect a loop because the pieces of P2 are not on the board.

Regards,
Eric


RE: (is Loop) not recognizing all loops - Michael - 06-07-2021

Ah, ok. Thanks for that explanation!


RE: (is Loop) not recognizing all loops - AlekErickson - 06-09-2021

This game, I made a loop, and then Ludii didn't recognize it as a loop.
Then, the computer made a loop, and it recognized it as a loop and it won. 
Something must still be wrong with the (is Loop), because I saw no difference between my loop and the AI's loop.

EDIT: made another trl, where a bona fide loop went unrecognized for several turns.


RE: (is Loop) not recognizing all loops - Eric Piette - 06-10-2021

Hi,

Like I said to Michael, I will make it more general later and consequently test many more cases in doing that. So because I have to probably rewrite a lot of parts of the code of (is Loop) I am not going to look for the current implementation.

Regards,
Eric