Ludii Forum
(is Path ...) without length - 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: (is Path ...) without length (/showthread.php?tid=423)



(is Path ...) without length - xenos1984 - 02-07-2021

The LLR suggests that the length: argument to (is Path ...) is optional:

Code:
(is Path <siteType> (<player> | <roleType>) ([length:<int>]
([maxLimit:<int>]) [closed:<boolean>])

However, I get an unreadable error loading the attached file, which contains this condition:

Code:
(is Path Edge Mover closed:True)

Is there a way to check for a path of arbitrary length?


RE: (is Path ...) without length - Eric Piette - 02-08-2021

Hi,

The grammar for (is Path ...)

is

(is Path <siteType> (<moves.player> | <roleType>) [length:<int> | maxLimit:<int>] [closed:boolean])

We noticed last week that the grammar in the LLR was not updated since before the first release ;) It would be updated for the next one.

However to always look the current grammar of a specific version of Ludii you can print it (in a terminal and in the status tab) with the menu button Game --> Generate Grammar.

Concerning the ludeme you are trying to use (is Path ...). That's one of the (rare) ludeme I never touched and was written by one of our internship. In taking a quick look, I saw that ludeme is used only for the graph theory games of that same internship, so if you encounter any problem with it, let me know but the fix can potentially be longer than the others.

In looking the arguments, I would say the easy way for you to check any size is to put a really important size in the maxLimit argument size.

Regards,
Eric


RE: (is Path ...) without length - xenos1984 - 02-08-2021

Thanks, Eric, this helped indeed! I guess the least restrictive setting is maxLimit:(count Edges), which effectively disables the maximum.

(02-08-2021, 07:31 AM)Eric Piette Wrote: However to always look the current grammar of a specific version of Ludii you can print it (in a terminal and in the status tab) with the menu button Game --> Generate Grammar.

That's good to know, and really useful. Just for clarification - I might have misinterpreted the meaning of the parentheses and square brackets. I would have read

Code:
(<moves.player> | <roleType>)

as "exactly one of <moves.player> or <roleType>", and

Code:
[length:<int> | maxLimit:<int>]

as "at most one of length:<int> or maxLimit:<int>", thus allowing also to omit both length and maxLimit.


RE: (is Path ...) without length - xenos1984 - 02-12-2021

I've tried it with the newest version, and still it's not quite doing what I would have expected. I use the same .lud for "toy model Projex" attached to the first post of this thread. With the current (dummy) winning condition, the mover should win after closing a path of length at most 6 (number of sites). However, this does not happen. If I use the attached trial Projex_conn.trl and evaluate the following ludemes at the end of the trial, all of them yield false:

Code:
(is Path Edge P1 length:3 closed:True)
(is Path Edge P1 maxLimit:3 closed:True)
(is Path Edge P1 maxLimit:6 closed:True)
(is Path Edge P1 maxLimit:(count Edges) closed:True)

To check with a "working" game, I tried Icosian. But the result is the same. All of these yield false in the final state of Not_closed.trl:

Code:
(is Path Edge P1 length:19 closed:False)
(is Path Edge P1 length:20 closed:False)
(is Path Edge P1 maxLimit:19 closed:False)
(is Path Edge P1 maxLimit:20 closed:False)

Funnily, though, Ludii believes to have won, although no Hamiltonian path is constructed. The reason is that the win condition is simply to make as many moves as are necessary to form a Hamiltonian path (20 moves), which is also the maximum number of edges that can be colored. So if it gets "stuck", it can only color a smaller number of edges. But in this case after coloring 19 edges, not closing the path, the AI simply makes a Pass move, and so has made 20 moves - which is counted as a win.


RE: (is Path ...) without length - Eric Piette - 02-12-2021

Hi,

Ok thanks for that reporting. Like I said in a previous message, I am not the author of that specific ludeme and by consequent I should rewrite it completely to avoid any future problem. I am adding to myself a TODO to look at it later :)

Regards,
Eric


RE: (is Path ...) without length - xenos1984 - 02-12-2021

Thanks a lot, I'm looking forward to it! :)