Ludii Forum
Stacks - 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: Stacks (/showthread.php?tid=221)

Pages: 1 2


RE: Stacks - Eric Piette - 11-17-2020

Hi,


Quote:So to be clear the "Y" problem here is I am trying to restructure my syntax to see if that helps my "X" problem. Specifically I wonder if I can express "move Step " using the "move <from> <to>" syntax.


Yes you can but I am not sure why you need that?


Quote:The "X" problem is how do I make a player move the piece from a stack that is a.) one of their pieces and b.) a piece of their choice. (I admit with only 1 piece each b.) is redundant but it will be relevant in the future. ) At the moment it (as described earlier in the thread) moves the top piece even though that belongs to the opponent.


You mean moving any piece in a stack? So to be clear
If you have a stack of (Piece1, Piece2, Piece3), all these pieces owned by the mover, you want to be able to move any of these pieces?

Regards,
Eric


RE: Stacks - slimy_asparagus - 11-17-2020

(11-17-2020, 01:14 PM)Eric Piette Wrote:
Quote:The "X" problem is how do I make a player move the piece from a stack that is a.) one of their pieces and b.) a piece of their choice. (I admit with only 1 piece each b.) is redundant but it will be relevant in the future. ) At the moment it (as described earlier in the thread) moves the top piece even though that belongs to the opponent.


You mean moving any piece in a stack? So to be clear
If you have a stack of (Piece1, Piece2, Piece3), all these pieces owned by the mover, you want to be able to move any of these pieces?

Yes. Because as I implement the game those pieces will be different.

Actually the situation is worse at the moment.

There is a stack (My piece at the bottom, Opponent's piece at the top). Whatever I do it it selects the top piece rather than my piece. (You do need to use the first .lud I attached not the one with the compile error.)

I would not normally expect to be able to move an opponent's piece (with some exceptions).

I would still appreciate an answer to the "Y" question, if nothing else so I can start to actually understand Ludii.


RE: Stacks - Eric Piette - 11-18-2020

Hi,

Ok sorry I am now completely lost after all these messages. I am working on many aspects in the same time and I help many people on the forum.

So, can you send me one .lud with what you try to do and with one question on it for me to answer.

Thanks.

Regards,
Eric


RE: Stacks - slimy_asparagus - 11-18-2020

(11-18-2020, 10:13 AM)Eric Piette Wrote: Hi,

Ok sorry I am now completely lost after all these messages. I am working on many aspects in the same time and I help many people on the forum.

So, can you send me one .lud with what you try to do and with one question on it for me to answer.

Thanks.

Regards,
Eric

Eric,

I have  attached a file test.lud. This is as stripped down as I can make. Yellow is to move. But when yellow tries to move its piece, it moves the blue instead. How do I fix this?

Nicholas


RE: Stacks - Eric Piette - 11-19-2020

Hi Nicholas,

Thanks for that example.
The step move is not, in its current stage, able to move a piece in the middle of a stack in specifying a level in the from value. But it should. Consequently, I just implemented the small update to be able to do that. That's now working in our dev version. And will be published in the next release.
Consequently, your description is correct to do what you expect, unfortunately that case was not implemented and used in any game before.

However, this is already implemented for the (move ...) ludeme, so maybe now I understand why you wanted to rewrite the step with a (move ...)
Here the equivalent description of the define used in the .lud but with the equivalent (move ...). 

Code:
(define "MoveWithinBoard"
    (move
        (from (from) level:(level))
        (to (intersection (sites Around (from)) (sites Outer)))
    )
)


You can try with the version 1.1.1, that's should work.
However, when you will drag the bottom yellow piece, the GUI will drag the full stack but when you will select the site to go, the correct move is applied. The GUI is not my domain, I warned Matthew about that dragging issue to see if he can do something for that.

If you have another issue, please use the same process with another .lud and a question, that's easier for me to understand and investigate in the problem :) Thanks!

Regards,
Eric


RE: Stacks - MatthewStephenson - 11-19-2020

Hi Nick,

I've updated our stack drawing code to address your problem, this will be included in the next Ludii release.

Cheers,
Matthew


RE: Stacks - slimy_asparagus - 11-19-2020

Eric,

Thanks. That has worked. I can move onto the next thing now.

Matthew,
 
I look forward to the next version.


RE: Stacks - slimy_asparagus - 11-20-2020

[quote pid='881' dateline='1604308511']
Minor remark about it, you currently does not check if some pieces are still in the hand of the mover. Consequently that's possible to move from an empty sites to any outer sites.
A more accurate description can be:
    (move
        (from (sites Occupied by:Mover container:(mover)))
        (to (sites Outer))
    )
[/quote]

Okay this comment finally paid off. I was "playing" against the AI and I found it was doing this so I have added something like this to my code.


RE: Stacks - slimy_asparagus - 11-24-2020

(11-19-2020, 09:29 AM)MatthewStephenson Wrote: Hi Nick,

I've updated our stack drawing code to address your problem, this will be included in the next Ludii release.

Cheers,
Matthew


Matthew,

The update worked. Thanks to you and Eric.

Nicholas