![]() |
Swap within a stack - 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: Swap within a stack (/showthread.php?tid=286) Pages:
1
2
|
Swap within a stack - slimy_asparagus - 11-25-2020 I am trying to flip over a stack of pieces. I am not actually sure I can even express this. A very simplified example of what I tried to do is: Code: (move Select (from (site)) RE: Swap within a stack - Eric Piette - 11-26-2020 Hi, If you try to flip a full stack, that is not currently implemented in the Moves ludeme (flip ...). That's one of my task in my todo list and that will be done in a future release. Regards, Eric RE: Swap within a stack - slimy_asparagus - 11-26-2020 (11-26-2020, 12:34 PM)Eric Piette Wrote: Hi, Okay but I am not sure that will be quite what I need. Firstly what "flip" means in Ludii seems to be modelled on reversi. But I can't relate that to my game. Instead I using a combination of a load of swaps and promotes seems to be a better model. (Although the "promote" will not be especially efficient. ;-() Secondly there are a few other situations. What I need is to be able to iterate through the layers of a stack. I would have thought that is something you want to have and would be more flexible. RE: Swap within a stack - slimy_asparagus - 11-27-2020 (11-26-2020, 12:34 PM)Eric Piette Wrote: Hi,Okay, please allow me to ask the question a different way. Can you give us an idea of what this new feature will allow us to do when it is eventually implemented? What sort of games would it help implement? RE: Swap within a stack - Eric Piette - 11-27-2020 Hi, The (flip ...) ludeme is currently flipping one single piece in modifying the site state to the equivalent one defined with the (flips ...) in the corresponding component (e.g. Reversi). When the stack will be implemented with (flip ...), the full stack will be flipped. If you stack is from the ground to the top : A B C D That will be: D C B A Moreover if some of these pieces have some (flips ...) defined that will also be applied per piece. That implementation will be done in a future release, that's not a priority for the moment. That's not for a specific sort of game, that's just a feature which should be implement in the future. Regards, Eric RE: Swap within a stack - slimy_asparagus - 11-27-2020 Okay but I am still unclear how I will be able to do two things: 1. apply some operation (in this case "promote") to all the pieces in a stack. 2. Check if a piece meeting some criteria is directly above within the stack some different piece with some different criteria. RE: Swap within a stack - Eric Piette - 11-27-2020 Hi, So you just mean iterating all the pieces in a stack and doing whatever you want with them. I can add a (forEach Level (site) ...) to do that. I add that to my TODO and I come back to you with an example when done. Regards, Eric RE: Swap within a stack - slimy_asparagus - 11-27-2020 (11-27-2020, 03:15 PM)Eric Piette Wrote: Hi, Eric, Thank you so much. I have plenty to work on in the meantime. RE: Swap within a stack - slimy_asparagus - 03-26-2021 Eric, I can give an update from my point of view. Then I would like to ask if you have any idea where this is on your TODO list. Recap Currently Ludii supports a flip ludeme, which does not work for stacks. It was always always on your TODO list to extend it to stacks. However I could not see how I would be able to do what I was trying to do with a stack-compatible "flip". We discussed adding a "forEach Level" ludeme to the language spec. My update With all the wonderful work you have done on the stack model, I doubt I really need "forEach Level" any more. I think a stack-compliant flip would be sufficient and much easier. However, I did put some thought into implementing Unstack which is on your wishlist. (Tak is similar but that has a lot of IP relevance and I doubt you would ever get permission to publish that so I would ignore that one.) I don't see how you can implement Unstack with the current Ludii specification. However "ForEach Level" might I believe make it possible. My proposal for Unstack So the copy for Unstack says: "It is a stacking game in which counters are distributed in a way that resembles the "sowing" in Kalah games." I know Ludii supports Kalah games via the "sow" ludeme. However as far as I can see "sow" would not work for Unstack, because "sow" represents one decision move. Once you have taken that decision the rest of the action is forced. In Unstack the "sowing" action is a chained sequence of separate choices. To quote from the rules: Quote:Move 1+ stone(s) at a greater distance (no diagonals), if he leaves at least one cell on each intermediate cell. The "at least one" bit is what makes this not a single decision move. However I believe a "forEach level" ludeme would solve this. It would be needed in two places. 1. The primary decision move would be to move a piece to a neighbouring space subject to appropriate rules. 2. You then need a "then" clause that moves all pieces stacked above it along the same path. This will require a "forEach Level" operation. 3. A final "then" clause does a (moveAgain) if any pieces can be moved. The second usage will pick up the pieces moved in the above action and allow them to be moved in the same way. This too will require a "forEach Level". It too will do a (moveAgain) if any pieces can be moved. So My Questions Please could you give us some sort of timeline on 1. stack compliant flips? 2. forEach level ? 3. Are you likely to implement both or just one. If so which one? 4. Do you have any comments on my analysis of Unstack? (Note: Please don't delay any upcoming release of Ludii for anything in this post.) Nicholas RE: Swap within a stack - Eric Piette - 04-06-2021 Hi, 1) That's still on my TODO (which is not a stack compared to what you asked :) but more a set of things to do with no order except our DLP project first :D) So a bit hard to tell you when I will do it, I will try to prioritize it, the code should be simple to do in reality. 2) Same answer, easy code, will try to prioritize it, but I just come back from holidays so I have first a lot of little tasks to do everywhere :) 3) Both, they are both useful for different usage. 4) Not for the moment, when they will be done, I will let you a msg here (I added that to my TODO issue to not forget :)) Eric |