Ludii Forum
(count Groups if:) - Printable Version

+- Ludii Forum (https://ludii.games/forums)
+-- Forum: Questions (https://ludii.games/forums/forumdisplay.php?fid=13)
+--- Forum: About the Ludii Grammar (https://ludii.games/forums/forumdisplay.php?fid=15)
+--- Thread: (count Groups if:) (/showthread.php?tid=675)



(count Groups if:) - Michael - 08-15-2021

No matter what boolean I try, (count Groups if:<boolean>) always returns 0 (even True, which I though would return 1). Can I get an example of how to use it? I wanted to count groups of empty cells. I thought that was as simple asĀ (count Groups if:(is Empty (to))).


RE: (count Groups if:) - Eric Piette - 08-18-2021

Hi,

(count Groups ...) is implemented to count the group of pieces, not of empty sites. However, this can be improved, so I will.
Similarly for the issues, you have with the condition on the group (even True), it is looking for real pieces, so if any empty site is there, it will not work.
Anyway, I am going to improve that. I come back to you when done.

Regards,
Eric


RE: (count Groups if:) - Eric Piette - 08-18-2021

Hi,

Ok, I did the change. That will be in the next release.
So from now, you will be able to use the condition to count the groups checking that condition (empty sites too) and I removed the roleType from the parameters because the condition is more general and clearer (even more efficient) than that.

Regards,
Eric


RE: (count Groups if:) - Michael - 08-18-2021

Thanks, that's great news!


RE: (count Groups if:) - Michael - 08-19-2021

On the required changes page it says that no change is required to upgrade a script from 1.2.5 to 1.2.6, but that is not correct, since (count Groups) no longer recognizes the roletype keyword. I just tried to load a script using it that I had been working on recently and was confused at first, since I had not made any changes since it last worked, but then I remembered this change.


RE: (count Groups if:) - Eric Piette - 08-20-2021

Hi,

Yes right, I am going to update that.

Regards,
Eric