Ludii Forum
problem with (set Score ... (then ...) - Printable Version

+- Ludii Forum (
+-- Forum: Problems (
+--- Forum: Game Problems (
+--- Thread: problem with (set Score ... (then ...) (/showthread.php?tid=742)

problem with (set Score ... (then ...) - dale walton - 10-31-2021

The attached game is supposed to update the scores according to the number of enclosed empty sites times the number of enclosed regions (whether or not empty)

It is properly calculating enclosed sites and seed sites,  but it is not properly calculation the (size Array ()) values in the (set Score #1 (...) (then (...))) Presumably because it is forgetting the remembered values before counting them)

If this is not a bug, please tell me how to do it correctly. - But it looks like it is clearly a bug.
Re Edit: I thought, I found a work-around by scripting in a dummy consequence. May help you to find what's wrong...

However it still doesn't pick up the remembered values reliably...

How does the script need to be structured to ensure the final values are used? do I need to use (results ...)?

RE: problem with (set Score ... (then ...) - Eric Piette - 11-01-2021

Hi Dale,

I am not 100% sure of the question in detail here because the description of that game is a bit too long for me to look at it in detail.

I just look at the values in the remembering values after applying your trial and they are just empty which explains the score to be 0 for them. But I am not sure of all that you are doing there.


RE: problem with (set Score ... (then ...) - dale walton - 11-01-2021

I have a game with a scoring for which you don't have an easily applicable ludeme.

The score is the product of 2 factors:

The first factor is the count of all the empty sites that are enclosed by a player's pieces (tihs  'enclosure is not the Ludii enclosure, as the edges of the board cannot be used for enclosure - anything connected to an edge site is not enclosed.

The second factor is the number of regions that a player's pieces create (excluding regions connected to the edge.)
These regions may be entirely empty, partially filled with enemies or completely filled with enemies (i.e. it is a count of discrete groups of non-friendly sites, whether or not occupied.)


The group ludemes don't work well when there is no piece in a 'group', i.e. they do not respond consistently to the same boolean conditions. (eg count Groups, size groups, sizes Groups don't seem to give consistent results.)  Therefore I am attempting to work-around by remembering a list of sites, and then count how many independent regions those sites form.

For the first factor I am filtering that list of sites for those sites that are empty.  However I am having problems with the remembered values (which are correct) being forgotten before being assigned to the score. Or  being recalculated.  (do next... is not helping with this.

I  think there is also a problem in my logic to count the number of discrete regions that a set of sites (as opposed to pieces) is composed of. I was trying to add sites to a list if the selected site was not connected to a site already in the list.
The problems probably are stemming from a procedural world view - but I can seem to find the non-procedural constructs that work in this case.

Maybe an extension of (remember) could help? eg. adding an if:() and iterartor  (value) for the value to add, and (values) for the currently remembered values. and internally make sure that no other use of that list occurs while the value is being tested and added to the list?

Or region  processing: (count Regions , sizes Regions etc if groups don't generalize to empty regions.

(remember Value () if:(= Infinity (count Steps (step Orthogonal ... ) (value) (values)))

The short answer is please look at any turn of the trial on the full moves tab and see the values remembered, and then the score assigned, and then the values forgotten, which follows the logic, except that the score assignments was supposed to be calculated from the counts of the values remembered.

When I located the forgets to the beginning of the turn I wasn't getting any scoring at all.

RE: problem with (set Score ... (then ...) - dale walton - 11-01-2021

I have done a rewrite to do this without remember, and combines some of the logic. It seems to be working.