Ludii Forum
Stacking certain counts of pieces causes Exceptions - Printable Version

+- Ludii Forum (https://ludii.games/forums)
+-- Forum: Problems (https://ludii.games/forums/forumdisplay.php?fid=5)
+--- Forum: Grammar Problems (https://ludii.games/forums/forumdisplay.php?fid=24)
+--- Thread: Stacking certain counts of pieces causes Exceptions (/showthread.php?tid=1250)



Stacking certain counts of pieces causes Exceptions - fuerchter - 09-19-2022

Hi,
using this .lud will cause a java.lang.ArrayIndexOutOfBoundsException as soon as the stack is added. Also, if you instead set the count to be added to 1 and add 31 pieces to a single stack manually, the same exception occurs. I had a short search across documentation and have not found a maximum limit to a stack (I might have missed it?). This was tested on Ludii 1.3.6.


RE: Stacking certain counts of pieces causes Exceptions - Eric Piette - 09-20-2022

Hi,

It is normal. By default, Ludii has a limit for the size of the stack (in order to have a state computed behind the board which is more efficient). However, if you need higher stacks, you can specify the "largeStack:" argument of the (board ...) ludeme to be true.

e.g.
(board (hex 5) largeStack:True)

Eric


RE: Stacking certain counts of pieces causes Exceptions - fuerchter - 09-20-2022

Sorry, I definitely could have found this on my own (I think I would like to have this somewhere in the Game Logic Guide though).
What I don't understand: The Language Reference says about largeStack: "The game can involves stack(s) higher than 32."
However, as you can see in my example .lud above, even just playing the count:16 stack will already cause the exception on my end. This also happens if you replace "(sites Board)" with "(sites Empty)" as possible places to add them to. In this case it wouldn't even be possible to have a stack larger than 16 as far as I know.


RE: Stacking certain counts of pieces causes Exceptions - Eric Piette - 09-20-2022

Hi,

I think that's because the computation code is checking if the move would be legal, and during the computation, the code is probably generating a stack of size 32 to try this, which creates the exception.

Regards,
Eric