Ludii Forum
(flip (last To)) has no effect - 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: (flip (last To)) has no effect (/showthread.php?tid=127)



(flip (last To)) has no effect - ccxvii - 08-14-2020

I wanted to try implementing The Duke, where the pieces are tiles that flip over after moving, and move differently depending on which side is up.

I've set up the pieces with (flips 1 2) to toggle between the two states, and after moving I apply the (flip (last To)) move but it has no effect. Explicitly checking and setting the piece state works though.

This does NOT work:

(forEach Piece (then (flip (last To))))

This does work:

  (forEach Piece (then
    (if (= 1 (state at:(last To)))
      (set State (last To) 2)
      (set State (last To) 1)
    )
  ))


RE: (flip (last To)) has no effect - Eric Piette - 08-14-2020

Hi,

We need the full lud file to be able to take a look. Can you share it with us?

Regards,
Eric


RE: (flip (last To)) has no effect - ccxvii - 08-14-2020

Sorry, I thought I'd already attached it...

Attached the wrong version of the file.


RE: (flip (last To)) has no effect - Eric Piette - 08-14-2020

Hi,

Ok it was not possible in the version 1.0.2 to define the flips values for a tile. I just add that to the ludeme tile. We do a release this afternoon, you will be able to use the (flip (last To)) as expected with the new version.

Of course you will need to define the flips values in the tile piece like

Code:
(define "Tile"
    (tile #1 Each numSides:4 (flips 1 2)
       (if (= 1 (state at:(from)))
         #2
         #3
        )
     )
)


Regards,
Eric Piette