Ludii Forum
Restrict movement for promoted pieces - 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: Restrict movement for promoted pieces (/showthread.php?tid=552)



Restrict movement for promoted pieces - Enrique - 04-24-2021

I've just coded the rules for the movement for all the pieces of my game and everything works fine. I want to add a restriction but I don't know how to do it.

I want that pieces that had been promoted on the previous turn are forbidden to move on the current turn. (But only on the current turn not on turns after this.)

Any idea on how this could be done?


RE: Restrict movement for promoted pieces - cambolbro - 04-24-2021

Hi,

You could try setting the Pending value to equal the site on which a promotion is made, disallow moves at Pending sites, then turn it off again next move. Chess uses a similar mechanism for handling en passant:


Code:
(define "InLocationEnPassant"
    (and
        (is Pending)
        (= (to) (value Pending))
    )
)

Regards,
Cameron