06-07-2021, 07:54 PM
(This post was last modified: 06-07-2021, 08:27 PM by slimy_asparagus.)
I am looking for a way to do a non-decision move before or-clause of decision moves.
I feel like I have previously mastered the core decision paradigm in Ludii.
The problem I am hitting is that some of those decision moves need to register that they were done in the game state until we get back to our next initial decision move. I am using the "value" in the effected pieces to remember this.
So for the effected pieces I set the value when they are placed.
If the state is triggered then I set the value when and where appropriate.
So what I am struggling to do is to reset the value to its initial state just before that (or .... ) clause, so that it is fresh everytime a player starts their turn.
I don't believe I can use "Pending" because a turn could consist of theoretically 8 moves.
The (or ....) ludeme has an optional (then) clause. That is almost what I want, except that I need my non-decision to trigger just before the (or...) not after.
I know there is an (apply....) ludeme but that would be very difficult to fit across all the different cases.
I have tried to use a (do next:) Ludeme. That compiles but does not seem to work. I don't know why.
If I use (and .... (then....)), then it compiles but says you have to pass immediately.
Similarly for (append ... (then...)). Though I do see why these latter ones did not work.
Hmm, okay I have an idea. The (if.. ) ludeme has an optional (then clause). Maybe I could use that to reset the flag for the next player.
So I move the reset from the beginning of a player's turn to the end of the previous player's turn. That sounds worth trying.
Nope that won't work for the same reason Pending won't. I can't see anyway I could check if it was the end of the turn.OR at least it would be as difficult as trying to squeeze (apply ...) into every bit of code.
So what would be really great, is if the (or...) ludeme could have an optional (apply ....) clause like it has a (then ...) clause.
So we could say "Do one of these N moves, but whichever one you choose, do P first and Q afterwards." So we can already say "do Q afterwards". As far as I can see there is no way of saying "do P first".
I feel like I have previously mastered the core decision paradigm in Ludii.
Code:
(play
(if "SameTurn"
(priority {
.....
..... a series of decision moves required/allowed by the previous decision move
.....
.....
})
(or {
.....
..... a selection of alternative initial decision moves
.....
})
)
)
The problem I am hitting is that some of those decision moves need to register that they were done in the game state until we get back to our next initial decision move. I am using the "value" in the effected pieces to remember this.
So for the effected pieces I set the value when they are placed.
If the state is triggered then I set the value when and where appropriate.
So what I am struggling to do is to reset the value to its initial state just before that (or .... ) clause, so that it is fresh everytime a player starts their turn.
I don't believe I can use "Pending" because a turn could consist of theoretically 8 moves.
The (or ....) ludeme has an optional (then) clause. That is almost what I want, except that I need my non-decision to trigger just before the (or...) not after.
I know there is an (apply....) ludeme but that would be very difficult to fit across all the different cases.
I have tried to use a (do next:) Ludeme. That compiles but does not seem to work. I don't know why.
If I use (and .... (then....)), then it compiles but says you have to pass immediately.
Similarly for (append ... (then...)). Though I do see why these latter ones did not work.
Hmm, okay I have an idea. The (if.. ) ludeme has an optional (then clause). Maybe I could use that to reset the flag for the next player.
So I move the reset from the beginning of a player's turn to the end of the previous player's turn. That sounds worth trying.
Nope that won't work for the same reason Pending won't. I can't see anyway I could check if it was the end of the turn.OR at least it would be as difficult as trying to squeeze (apply ...) into every bit of code.
So what would be really great, is if the (or...) ludeme could have an optional (apply ....) clause like it has a (then ...) clause.
So we could say "Do one of these N moves, but whichever one you choose, do P first and Q afterwards." So we can already say "do Q afterwards". As far as I can see there is no way of saying "do P first".