Ludii Forum
are moves in (and ... ) really sequential? - Printable Version

+- Ludii Forum (https://ludii.games/forums)
+-- Forum: Problems (https://ludii.games/forums/forumdisplay.php?fid=5)
+--- Forum: Ludii Player Problems (https://ludii.games/forums/forumdisplay.php?fid=6)
+--- Thread: are moves in (and ... ) really sequential? (/showthread.php?tid=324)



are moves in (and ... ) really sequential? - dale walton - 12-09-2020

The following extracted code in a script worked except that the pieces removed were not reflected in the scores on that turn.
The documentation implies and moves are sequential and remove defaults to immediate, so why wouldn't it reflect the change in piece count?

(define "UpdateScore"
  (and
    (set Score Mover (count Pieces Mover))
    (set Score Next (count Pieces Next))
  )
)

...
    (play
      (or
        (move Pass)
        (forEach Piece ... )
        (then
          (and
            (forEach
              Site
              (sites Board)
              (apply
                if:(= 0
                  (count Sites
                    in:(intersection
                      (sites Empty)
                      (sites Around (site) includeSelf:true)
                    )
                  )
                )
                (remove (site))
              )
            )
            ("UpdateScore")
          )
        )
      )
    )


RE: are moves in (and ... ) really sequential? - Eric Piette - 12-09-2020

Hi,

The moves computed by the (then ...) will be applied sequentially yes.
But that does not mean they will be computed as you though.
Here all the remove actions from your remove moves are computed then all the set scores. However when the set score are computed the removes are not applied at that moment. So they reflect the state before these remove actions.

Regards,
Eric


RE: are moves in (and ... ) really sequential? - dale walton - 12-09-2020

Why are they not yet applied, the documentation says the default is immediately, so  what does immediately mean, and is there an appropriate argument for at:... given that the actual decision move made depends on the existing neighborhood?

It is important for me to understand how to use remove.
In this particular case I have resolved it with a (do (forEach Site ... (remove (site)) next:("UpdateScore")).


RE: are moves in (and ... ) really sequential? - Eric Piette - 12-09-2020

Hi,

"immediate" means the remove actions are applied directly when the moves is applied and will not wait the end of the turn (like for the other parameter).

No the actions are all computed from a state s-1, to reach a state s. The intermediate modifications can not be used with just a simple parameter. The two ways to do that are the (do ...) as you just said or to use the consequence with (then ...). However for your case, the (do ...) seems the most appropriate way.

Regards,
Eric