Ludii Forum
All the ways to combine moves... - Printable Version

+- Ludii Forum (https://ludii.games/forums)
+-- Forum: Questions (https://ludii.games/forums/forumdisplay.php?fid=13)
+--- Forum: About the Ludii Grammar (https://ludii.games/forums/forumdisplay.php?fid=15)
+--- Thread: All the ways to combine moves... (/showthread.php?tid=138)



All the ways to combine moves... - ccxvii - 08-17-2020

Could you please write up (here or in the reference manual) a summary of how move generation works, and how the various ludemes that combine moves work? I'm very unclear on the details, and when one of the many constructs is better than the other. For example, here are some of my points of confusion:

(or A B) -- in player chosen moves, this is obvious, but what about non-decision effects? Are all applied, or is one picked randomly, or is it undefined behaviour?

(and A B) -- for non-decision effects, it seems it applies A then B, but what about player moves?

It seems that (or (move Slide) (move Step...)) behaves the same as (and (move Slide) (move Step...)) for decision moves in my experiments. If I combine decision and non-decision moves at the "top" level, the non-decision moves seem to be ignored.

What happens to state between the A and B moves in (and A B), and when should I use (and A B) to sequence effects versus (A (then B))?

Am I right in thinking that (then) has the same effect as (append) and (and) -- they all just concatenate moves but expressed in different ways?

  (move Slide (then (set Score ...))

results in the same as this:

  (append (move Slide) (then (set Score ...)))

and maybe even this:

  (and (move Slide) (set Score ...))

And what about the (do next:)?

  (do (move Slide) next:(set Score))


RE: All the ways to combine moves... - cambolbro - 08-17-2020

Hi,

We'll be writing a big paper on Ludii in September that will include details on how moves are implemented and handled internally. This should give a clearer picture of the mechanisms involved.

But it might be worth adding a chapter to the User Guide that explains this as well?

In the meantime I'll leave Eric (who wrote most of the movement code) to answer your specific questions.

Regards,
Cameron


RE: All the ways to combine moves... - ccxvii - 08-17-2020

I'm looking forward to it! This is a very exciting project.


RE: All the ways to combine moves... - dale walton - 09-17-2021

I have not yet seen any clarification on the meaning and use of (append) - does this mean the use of (append ) is not needed and it is depreciated for use? or is it an oversight?

Is there a ludeme that does what the following unreliable coding should do?

(and (<A>) (priority (<B> (then <C>)) (<C>))
i.e. A & C with B required before C, IF <B> EXISTS - so C always happens even without A&B
--------------------
Contrast the above with

(and (<A>) (<B>) (then (<C>))
which appears to be equivalent to:

(and ((<A>) (then (<C>))) ((<B>) (then (<C>))))

in this case C doesn't happen without a combination of A or B


RE: All the ways to combine moves... - Eric Piette - 09-17-2021

Hi,

You can see an example of the use of (append ...) in Reversi. This is not deprecated that's just another ludeme use to append a list of moves in a single one.

And for what you are asking, depend:
- if that's a consequence (so all of that inside a (then ...)), yes you can simply do (and (<A>) (<B>) (then (<C>)) which is not equivalent to (and ((<A>) (then (<C>))) ((<B>) (then (<C>))))

- But if you are outside of a consequence, you have to use a (or (do (and (<A>) (<B>)) next:<C>) (<C>))

Regards,
Eric


RE: All the ways to combine moves... - dale walton - 09-17-2021

OK thanks for that clarification. I though they were equivalent, because I often see duplicated <C> consequences with that structure, but the duplication I saw turns out to be coming from before the consequences began.