Ludii Forum
How to Push enemy? - Printable Version

+- Ludii Forum (https://ludii.games/forums)
+-- Forum: Questions (https://ludii.games/forums/forumdisplay.php?fid=13)
+--- Forum: About Ludii (https://ludii.games/forums/forumdisplay.php?fid=14)
+--- Thread: How to Push enemy? (/showthread.php?tid=350)

Pages: 1 2


How to Push enemy? - Alpha_(-1) - 12-30-2020

Sorry this is probably really simple, I've just been struggling for a few days now and I don't think I'm going to get anywhere. My game is very basic, I've gotten most of it, I just need my pieces to be able to push enemy pieces back one space in the direction they are being pushed. The move "Push" does not seem to be able to do this as it pushes any number of pieces, and it appears it can only push friendly pieces. There is only a very small section "push" on it in the logic guide, and the only game that uses it is incomprehensible, so maybe I'm wrong. I'm very much a beginner and I literally barely have a clue what I'm doing, but I'm intent on finishing this game. So if anybody could provide some insight on how to have opposing pieces push each other, that would make my day, thanks.


RE: How to Push enemy? - cambolbro - 12-30-2020

Hi Alpha,

The person who implemented that code (Eric) is on holidays this week. He'll answer your question when he gets back next week.

Regards,
Cameron


RE: How to Push enemy? - Eric Piette - 01-04-2021

Hi,

Yes Push is not used a lot for the moment.
During the next months, I will probably add more games using it.

But to help you, can you send me what you wrote for the moment about the .lud?
And an example with the game implemented of what you try to do but you are not able to?
Thanks to that I will be able to see if we can already do it or not.
If we can I will send you the modification to do to your .lud if not we will probably update the ludeme push.

Thanks!

Regards,
Eric


RE: How to Push enemy? - slimy_asparagus - 01-04-2021

If you don't mind I have an example. Hopefully Alpha-1 will have a different example and you can consider both. In my case the code is:

Code:
(push (from (last To)) (directions OppositeDirection of:Orthogonal))

This does not even compile. I have an image of the error here: https://boardgamegeek.com/image/5877981/slimy-asparagus.

I attach the .lud.
[url=https://boardgamegeek.com/image/5877981/slimy-asparagus][/url]


RE: How to Push enemy? - Eric Piette - 01-04-2021

Hi,

The ludeme (push ...) expects an AbsoluteDirection in entry and not a DirectionFunction.

Regards,
Eric


RE: How to Push enemy? - slimy_asparagus - 01-04-2021

(01-04-2021, 10:06 AM)Eric Piette Wrote: Hi,

The ludeme (push ...) expects an AbsoluteDirection in entry and not a DirectionFunction.

Regards,
Eric
So is there any possibility of having "push" and "move Push" extended to allow a DirectionFunction? It would make the code a lot simpler and I am not clear what the point of  a "OppositeDirection" direction is, if you can't use it in practice.


RE: How to Push enemy? - Eric Piette - 01-04-2021

Hi,

Probably yes.
I did not used too much Push for the moment, I guess more options can be added to it.
I will tell you if we make some modifications to that ludeme.

Regards,
Eric.


RE: How to Push enemy? - slimy_asparagus - 02-13-2021

The new syntax:

Code:
(directions Cell from:(last To) to:(last From))
gets me a bit closer on quixo. However this syntax returns a list of directions. For the non-decision push ludeme I believe I need a single direction. I don't see how to get the first, last or even a random direction out of  a list of directions.


RE: How to Push enemy? - Eric Piette - 02-13-2021

Hi,

The (push ...) ludeme is not completely done and almost never used by us (one game I think). It is still in my TODO list to be improved/completed. For example, it will have in entry a Direction (included the direction functions), which will solve what you said before. Same idea if you see other ludemes with a direction (like AbsoluteDirection) which is not currently a Direction (so included the direction functions).

We will not add a ludeme to get a specific direction in such a list with only the index. Because the index used does not have any meaning for a designer/human. However, to take a random number of directions in such a list of directions can be interesting and we can add that ludeme, yes (I add that to my TODO list).

Eric


RE: How to Push enemy? - slimy_asparagus - 02-14-2021

As it happens

Code:
(directions Cell from:(last To) to:(last From))

only returns one Direction. So I wonder if I can use "forEach Direction" to get at this. However I am not clear how I would do this from looking at the language reference. (This is a very similar question to forEach Group if:.)