Ludii Forum
Unplayable legal moves - Printable Version

+- Ludii Forum (https://ludii.games/forums)
+-- Forum: Problems (https://ludii.games/forums/forumdisplay.php?fid=5)
+--- Forum: Ludii Player Problems (https://ludii.games/forums/forumdisplay.php?fid=6)
+--- Thread: Unplayable legal moves (/showthread.php?tid=638)



Unplayable legal moves - Michael - 07-08-2021

In the attached .lud, there are many legal moves that (even though they are even marked as such) cannot be made. The random playouts also never reach the end of the game.


RE: Unplayable legal moves - Eric Piette - 07-09-2021

Hi,

The reason is because you are trying to set the local state to a really big value which is 1000000000, so if you open Ludii with a terminal you will see that error:
Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: Chunk value 1000000000 is out of range for size = 8
at main.collections.ChunkSet.getAndSetChunk(ChunkSet.java:1437)
at other.state.zhash.HashedChunkSet.setChunk(HashedChunkSet.java:167)
at other.state.container.ContainerFlatState.setSite(ContainerFlatState.java:572)
at other.action.state.ActionSetState.apply(ActionSetState.java:121)

I really do not advise you to set the state to that value (which probably come from the Infinity value returned from the (count Steps ...) when no path exists between two sites).
But if you really want to set that value, in theory, you can, in modifying the maxState value in any of the piece of your game with
(piece "Disc" Each maxState:1000000001)

But that's really not recommended and will probably make all the computation of the legal moves much slower.

Regards,
Eric


RE: Unplayable legal moves - Michael - 07-09-2021

Ah, I see. I didn't realize I was doing that. Thanks!

I wonder, would this work?:
Code:
(define "StoreValueAtSite"
    (set Var "#1" #2)
)

(define "ReadValueAtSite"
    (var "#1")
)
That is, would the first define create a variable name based on what is passed to the function, or would it try to make a variable called "#1"? I'm imagining that I could pass it a site, 0 say, and then it would create a variable called "0".. So then I can set a variable to Infinity instead of the state of a site.


RE: Unplayable legal moves - Michael - 07-10-2021

I tried it, and I think it made a variable called "(site)", lol. It doesn't matter, btw. I never meant to set any state to Infinity or -1. That must have been a bug in my description. I'm still having trouble with the script as it is now, but I'll report back when I am able to put my problem in a more understandable form.


RE: Unplayable legal moves - dale walton - 07-10-2021

Hi Michael, If my understanding is correct, #1 isn't passing anything, its substituting script into the code. - To see its effect on the script, open the code in the "Expanded editor" after it is compiled and loaded.


RE: Unplayable legal moves - Michael - 07-11-2021

Thanks for helping, Dale! I found out I don't need state or variables at all, so the game is working now :)