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

+- Ludii Forum (https://ludii.games/forums)
+-- Forum: Problems (https://ludii.games/forums/forumdisplay.php?fid=5)
+--- Forum: Game Problems (https://ludii.games/forums/forumdisplay.php?fid=17)
+--- 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:
Code:
(define "UpdateScore"
    (set Score Mover 0
        (then
            (forEach Group
                if:(= (id "Disc0") (what at:(to)))
                (addScore P1
                    (*
                        (count Sites in:(sites))
                        (count Sites
                            in:(sites Around
                                (sites)
                                Own
                            )
                        )
                    )
                )
            )
        )
    )
)
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

Hi,

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.

Regards,
Eric