Ludii Forum
(directions {<direction>}) - Printable Version

+- Ludii Forum (https://ludii.games/forums)
+-- Forum: Suggestions (https://ludii.games/forums/forumdisplay.php?fid=10)
+--- Forum: Ludii Features / Services (https://ludii.games/forums/forumdisplay.php?fid=11)
+--- Thread: (directions {<direction>}) (/showthread.php?tid=633)



(directions {<direction>}) - Michael - 07-05-2021

I wonder if it would be possible to have a direction function that combines directions, like (directions {<absoluteDirection>}) and (directions {<relativeDirection>}), but which works for all directions.

I wanted to combine (directions Cell from:(last From) to:(last To)) and some function of that direction ("NextDirectionCW" (directions Cell from:(last From) to:(last To))), but ended up having to use (difference <direction> <direction>) in order to combine them. It seems to me to be logically equivalent to what I am suggesting, but it is not pretty, and not very readable:
Code:
(difference
    Orthogonal
    (difference
        (difference
            Orthogonal
            (directions Cell from:(last From) to:(last To))
        )
        ("NextDirectionCW" (directions Cell from:(last From) to:(last To)))
    )
)

I cannot be sure I that my workaround works at all, though, because the scripts I have tried it in reports an error:
Quote:Exception during game creation: java.lang.reflect.InvocationTargetException
This is the same error I reported here, and I suspect this very bit of code is the problem.


RE: (directions {<direction>}) - Eric Piette - 07-06-2021

Hi,

Unfortunately not, the conversion of the AbsoluteDirection and RelativeDirection to just directionFunction is done in that ludeme, before to return the result. So we can not mix these two types inside this ludeme, they have to be separated.

I fixed the other issue you reported before (Noose).

Regards,
Eric