08-02-2020, 04:55 PM
There's four points I've noticed looking into your code:
1. The LineOfSight sites part should be written as "(sites LineOfSight at:(last To))". That's almost exactly what you wrote in your post already, but importantly, there cannot be a whitespace between the "at:" argument name and the subsequent opening bracket of the "(last To)".
2. The (score ...) ludeme used in the End rules can only have two arguments; a <roleType> and an <int>. See 13.2.1 of the Ludii Language Reference (https://ludii.games/downloads/LudiiLangu...erence.pdf). Both of the occurrences of this ludeme in your code have a third (again a roleType) at the end, which cannot be included there.
3. The "at:<int>" argument of the (count ...) ludeme is a named argument, so the "at:" prefix needs to be explicitly included, changing "(count Neighbours (last To))" to "(count Neighbours at:(last To))". See 8.5.1 of the Ludii Language Reference.
4. The array argument of (byScore ...) only accepts elements of type "<score>" (see 5.2.1 of the language reference), which doesn't include the (addScore ...) ludeme.
If I remove / tweak some things according to the points above, I end up with the following code which does compile (but I did remove some things so it's probably not yet exactly the game that you wanted, to help more with that we first need to know exactly how you do want the game to play):
1. The LineOfSight sites part should be written as "(sites LineOfSight at:(last To))". That's almost exactly what you wrote in your post already, but importantly, there cannot be a whitespace between the "at:" argument name and the subsequent opening bracket of the "(last To)".
2. The (score ...) ludeme used in the End rules can only have two arguments; a <roleType> and an <int>. See 13.2.1 of the Ludii Language Reference (https://ludii.games/downloads/LudiiLangu...erence.pdf). Both of the occurrences of this ludeme in your code have a third (again a roleType) at the end, which cannot be included there.
3. The "at:<int>" argument of the (count ...) ludeme is a named argument, so the "at:" prefix needs to be explicitly included, changing "(count Neighbours (last To))" to "(count Neighbours at:(last To))". See 8.5.1 of the Ludii Language Reference.
4. The array argument of (byScore ...) only accepts elements of type "<score>" (see 5.2.1 of the language reference), which doesn't include the (addScore ...) ludeme.
If I remove / tweak some things according to the points above, I end up with the following code which does compile (but I did remove some things so it's probably not yet exactly the game that you wanted, to help more with that we first need to know exactly how you do want the game to play):
Code:
(game "Trike"
(players 2)
(equipment {(board (hex triangle 5))(piece "Ball" Each)})
(rules
(meta (swap))
(play
(or
(if
(= (count Moves) 0)
(move Add (to (sites Empty)))
)
(move Add (to (sites LineOfSight at:(last To))))
)
)
(end
(if
(no Moves Next)
(byScore
{
(score P1 (count Neighbours at:(last To)))
(score P2 (count Neighbours at:(last To)))
}
)
)
)
)
)