Ludii Forum
Unable to iterate over groups in (then) - Printable Version

+- Ludii Forum (
+-- Forum: Problems (
+--- Forum: Game Problems (
+--- Thread: Unable to iterate over groups in (then) (/showthread.php?tid=537)

Unable to iterate over groups in (then) - Michael - 04-08-2021

In the attached game, the following ludeme should be called when a player ends their turn:
(define "UpdateScore"
    (set Score Mover 0
            (forEach Group
                if:(= (id "Disc0") (what at:(to)))
                (addScore P1
                        (count Sites in:(sites))
                        (count Sites
                            in:(sites Around
The way I understand this, it should first set the mover's score to 0, then go through all groups of "Disc0" and add to the mover's score the product of the group's size and the number of pieces they have next to that group. But the part inside (then) simply isn't executed. All that happens is that the score is set to 0.

What am I misunderstanding?

Oops. The "P1" should be "Mover", but that's irrelevant.

RE: Unable to iterate over groups in (then) - Eric Piette - 04-09-2021


That's interesting that was a double bug ;)
1) The consequences moves of the moves (addScore ...) and (set Score ...) were not taken in account
2) The ludeme (forEach Group ...) was not looking the neutral pieces and shared pieces.

Both are now fixed. And will be in the next release.