Ludii Forum
Simple question about (apply) - 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: Simple question about (apply) (/showthread.php?tid=300)



Simple question about (apply) - Michael - 11-28-2020

I'm still having problems understanding (apply). In the attached .lud, shouldn't the correct behavior be that, when I click an enemy stone it is replaced by a friendly stone? The relevant part of the script looks like this:
Code:
        (play
            (move Add
                (to
                    (sites Occupied by:Next)
                    (apply (remove (to)))
                )
                stack:true
            )
        )
I would think that the enemy stone is removed, then a friendly stone is added. But what happens is that the friendly stone gets stacked on the enemy stone. Why?


RE: Simple question about (apply) - Eric Piette - 11-30-2020

Hi,

The (apply ....) is not implemented for the Add ludeme. Unfortunately no game needed it until your example ;)

I will look to add it.

Regards,
Eric


RE: Simple question about (apply) - Eric Piette - 11-30-2020

Hi,

I just implement it for our dev version. That will be published with the next release.

Regards,
Eric


RE: Simple question about (apply) - Michael - 12-01-2020

Thank you! I have one more question about this:

If I set (var) inside (apply) in (move Add) and set the value of the "count"-parameter in (move Add) to (var), the value of (var) in the "count"-parameter is determined before it is set in (apply). Is it supposed to be like that?

For example: I set (var) to 2 in (apply) and set "count:" to (var). The effect is not that one adds 2 pieces.


RE: Simple question about (apply) - Eric Piette - 12-02-2020

Hi,

Yes that's normal. All the actions computed by a move are applied after the full move is computed, the only exception is the move (do ... next:...).

Regards,
Eric