Ludii Forum
I got so close... - Printable Version

+- Ludii Forum (
+-- Forum: Questions (
+--- Forum: About Ludii (
+--- Thread: I got so close... (/showthread.php?tid=273)

I got so close... - slimy_asparagus - 11-21-2020

I very nearly managed to make a substantive change and get it to work. It compiles and mostly works except for a bit of cleanup. I cannot see a way of simplifying the the code down to a test case. But I will try to explain.

1.) Each player has two sorts of pieces that move differently.

2.) They can pick one but they can only have one. (The idea is that these are two sides of the same piece). So I am trying to make that when one piece is moved onto the board the other is removed.

3.) So I increased the handsize to 2.

4.) I added a map that maps from one site in the hand to the other:

        (map "OtherHandSite"
              (pair (handSite P1 0) (handSite P1 1))
              (pair (handSite P1 1) (handSite P1 0))
              (pair (handSite P2 0) (handSite P2 1))
              (pair (handSite P2 1) (handSite P2 0))

5.) I added a "then" clause that removes the other hand site.

(define "MoveOntoBoard"
         (from (intersection (sites Occupied by:Mover container:(mover)) (sites Hand Mover)))
         (to Cell (sites Outer))
     (then (remove (mapEntry "OtherHandSite" (from))))

However it simply does not remove the other piece. I cannot see any way of debugging this. The note ludeme does not accept integers. I cannot inspect the map. I cannot see what I can do to investigate.

I enclose the full .lud file.

RE: I got so close... - slimy_asparagus - 11-21-2020

Okay I solved it. This works.

    (then (remove (mapEntry "OtherHandSite" (last from))))