Ludii Forum
Make pieces land only on dark squares after a hop - 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: Make pieces land only on dark squares after a hop (/showthread.php?tid=495)



Make pieces land only on dark squares after a hop - lvsor_ - 03-08-2021

I'm trying to code Frisian draughts. I'm not able to make pieces land only on the dark squares after a hop.



Code:
(piece "King" Each
    (move Hop
        Orthogonal                
        (between
            before: 10
            after: 10
            if: (is Enemy (who at:(between)))
        )
        (to if: (is In (to) (sites Phase 0)))
    )
)

This doesn't allow to play any legal moves.

If instead of the line

Code:
(to if: (is In (to) (sites Phase 0)))
I wrote

Code:
(to if: (is In (to) (sites Empty)))
the moving pieces can land in any square after the jumped piece, but with this other line

Code:
(to if: (is In (to) (sites Phase 1)))
the pieces can land only on the adjacent square after the jumped piece.

The example game
Code:
(game "Ortho hop"
    (players 2) 
    (equipment {
        (board (square 10))
        (piece "King" Each
            (move Hop
                Orthogonal                
                (between
                    before: 10
                    after: 10
                    if: (is Enemy (who at:(between)))
                )
                (to if: (is In (to) (sites Phase 0)))
            )
        )
    })

    (rules
        (start {
            (place "King1" {"C5" "E3"})
            (place "King2" {"C7" "E5"})
        })
        (play (forEach Piece) )
        (end (if (no Moves Next)  (result Mover Win) ) ) 
    )
)

(metadata
    (graphics {
        (board Style Chess)
    })
)




Thanks in advance.


RE: Make pieces land only on dark squares after a hop - Eric Piette - 03-10-2021

Hi,

In attachment, the modification to your file to be able to stop your hop move only on square cells.

Regards,
Eric


RE: Make pieces land only on dark squares after a hop - lvsor_ - 03-10-2021

(03-10-2021, 08:13 AM)Eric Piette Wrote: Hi,

In attachment, the modification to your file to be able to stop your hop move only on square cells.

Regards,
Eric
Thanks, I will try to submit Frisian draughts plus a couple of historical variants (Frysk! and 8x8) briefly