08-02-2020, 03:46 PM
I am now working on implementing a game where players must add a piece within line of sight of the most recent placement.
No matter what I try, it doesn't seem to work. I've tried all sorts of combinations with last To , LastTo, placing the parentheses or not, using the at: or not, but I can't get it to work. Can somebody figure out what is preventing it from compiling?
(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 (last To)) P1)(score P2 (count Neighbours (last To)) P2)(addScore Mover 1)})))))
No matter what I try, it doesn't seem to work. I've tried all sorts of combinations with last To , LastTo, placing the parentheses or not, using the at: or not, but I can't get it to work. Can somebody figure out what is preventing it from compiling?
(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 (last To)) P1)(score P2 (count Neighbours (last To)) P2)(addScore Mover 1)})))))