04-11-2021, 09:22 AM
Hi,
I was wondering if there is a simple way of getting the first element of an Integer array in Ludii.
I am trying to write the game "Shobu", and would like to do the following:
the issue with the above code is that the (ahead) ludeme takes a single direction, and the (directions) returns an array of directions (with only one element in this case).
I had a quick look at the Ludii Language Reference but could not find anything.
I have also attached my progress for Shobu so far. Feel free to provide feedback/advice, as I am pretty much stuck (I wrote FIXMEs and TODOs ).
The rulebook can be found here: https://ultraboardgames.com/shobu/game-rules.php
What's tricky for me is that it would make sense to use the "(push" ludeme for this game, but that ludeme only appears in one game in the ludii library (Pushing Me XO), so it's hard to find examples.
Kind Regards,
Fabio
I was wondering if there is a simple way of getting the first element of an Integer array in Ludii.
I am trying to write the game "Shobu", and would like to do the following:
Code:
(move Select
(from (site))
(to
(ahead
(site)
steps:(count Steps (last From) (last To))
(directions Cell from:(last From) to:(last To)) //FIXME: this should be a direction, not array of directions
)
if:(is In (to) ("CurrentBoard" (from))) //TODO: piece can only push ONE stone, of the opposite colour
)
(then
("ApplyPush")
)
)
the issue with the above code is that the (ahead) ludeme takes a single direction, and the (directions) returns an array of directions (with only one element in this case).
I had a quick look at the Ludii Language Reference but could not find anything.
I have also attached my progress for Shobu so far. Feel free to provide feedback/advice, as I am pretty much stuck (I wrote FIXMEs and TODOs ).
The rulebook can be found here: https://ultraboardgames.com/shobu/game-rules.php
What's tricky for me is that it would make sense to use the "(push" ludeme for this game, but that ludeme only appears in one game in the ludii library (Pushing Me XO), so it's hard to find examples.
Kind Regards,
Fabio