Ludii Forum
Wishlist of integer array features - Printable Version

+- Ludii Forum (https://ludii.games/forums)
+-- Forum: Suggestions (https://ludii.games/forums/forumdisplay.php?fid=10)
+--- Forum: Ludii Features / Services (https://ludii.games/forums/forumdisplay.php?fid=11)
+--- Thread: Wishlist of integer array features (/showthread.php?tid=316)

Pages: 1 2


Wishlist of integer array features - Michael - 12-05-2020

I know I’m asking a lot here, but I think the following would be extremely useful:

1. Give (values Remembered) and (remember Value) the same option as (var) and (set Var) of associating the result to a string:
(values Remembered [<string>])
(remember Value [<string>] <int> [unique:<boolean>] [<then>])
(forget Value [<string>] All [<then>])
(forget Value [<string>] <int> [<then>])

2. A (min) and (max) that operates on an array/set:
(min <intArrayFunction>)
(max <intArrayFunction>)

To be clear: I am very grateful for (sites <intArrayFunction>) and (set Var [string]), and I feel kind of bad for just asking for more and more, but I at least want it to be known that these features are wanted. Great work guys!


RE: Wishlist of integer array features - cambolbro - 12-05-2020

Hi,

No problems! Please keep the requests coming, so we can see what users want.

We do provide (min ...) and (max ...) ludemes that operate on lists of integers as well as functions that produce lists of integers:

    <ints.math.max> ::= (max <ints>) 
    <ints.math.min> ::= (min <ints>) 

where:

    <ints> ::= {<int>} | <intArray.math.difference> | <regions> | <results> | <rotations> | <sizes> | <values.values>

We'll look into adding the option to access specific (values ...) through user-defined labels.

Regards,
Cameron


RE: Wishlist of integer array features - Michael - 12-05-2020

Thank you! It seems I'm lagging a bit behind..
Dos this mean I can get a player's biggest stack like this?:
Code:
(max
    (results
        from:(sites Occupied by:Mover)
        to:1
        (*
            (size Stack at:(from))
            (to)
        )
    )
)

Also: Can I turn a region into an integer array with «from:<region>», «to:1» and (* (from) (to))?


RE: Wishlist of integer array features - Eric Piette - 12-07-2020

Hi,

No, what you have in your example here will return the maximum of an Integer array corresponding to the result of the product of 1 by the size of each stack by the mover.
So to sum up, that function returns the size of the highest stack of the mover.
And not the site where is that highest stack.

If you want to use that function, you will have after to check all the sites owned by the mover and to keep the sites where the stack size is equal to that value. With
(forEach (sites Occupied by:Mover) if:(= (size Stack at:(site)) (YOUR EXAMPLE)))

And for the other question, the answer is no.

Regards,
Eric


RE: Wishlist of integer array features - Michael - 12-07-2020

(12-07-2020, 07:40 AM)Eric Piette Wrote: No, what you have in your example here will return the maximum of an Integer array corresponding to the result of the product of 1 by the size of each stack by the mover.
So to sum up, that function returns the size of the highest stack of the mover.
That’s what I meant :)
As to the other question, I tried it out and it seemed like the answer was yes. I thought I got an array with the indices of each site in the region (which is what I meant by converting a region into an array).


RE: Wishlist of integer array features - Eric Piette - 12-14-2020

Hi,

It will be possible to associate the remembering values with a name in the next release (1.1.11)

Regards,
Eric


RE: Wishlist of integer array features - Michael - 03-21-2021

Not exactly an array function, but: Could we have a boolean function that quantifies over the values of an array, like (all sites) does for sites? So (all Values <intArrayFunction> if:<boolean>) would return True if and only if the boolean holds of all the values in the array.


RE: Wishlist of integer array features - Eric Piette - 03-22-2021

Hi,

You can currently convert an Array Int Function to a RegionFunction with (sites ...).

So I guess you can do something like (all Sites (sites <ArrayIntFunction) ...)

Regards,
Eric


RE: Wishlist of integer array features - Michael - 03-22-2021

Yes, but that would defeat my purpose, which is to disambiguate between two uses of (site) in the same context. If I had (all Values if:), then I could convert one region to an array and keep the other a region. Then I can refer to (value) and (site) to tell them apart.


RE: Wishlist of integer array features - Eric Piette - 03-22-2021

Ok I think that makes sense, because that's just a new Enum in (all ...) for us.

So yes I will add that feature (all Values ...) which it will be similar to (all Sites ...) but with (value).

Regards,
Eric