I'm having trouble understanding how to get identity of a piece or region for conditional logic.
I was able to use this code to return a player region depending on the player:
(define "EnemyBase"
(if (is Mover P1) (sites P2) (sites P1))
)
(regions "Base" P1 {60})
(regions "Base" P2 {66})
Which is used to determine if player has reached their goal:
(end (if (is In (last To) ("EnemyBase")) (result Mover Win)))
Is there a simpler way?
I'm currently getting syntax errors trying to use the following code to determine if the piece being moved is named "Stone" (which has specific restrictions during a multi-hop movement):
(define "PieceIsStone"
(= (what at:(from)) (id "Stone" Mover))
)
The code is similar to a line used in Jungle.lud to determine if if an enemy "Elephant" piece is on a space (at least I think that's what it does):
// A rat can capture an elephant if it is not in the water first.
(and
(not (is In (from) (sites "Water")))
(= (what at:(to)) (id "Elephant" Next))
)
Again, is there a simpler way? Or a correct syntax?
I was able to use this code to return a player region depending on the player:
(define "EnemyBase"
(if (is Mover P1) (sites P2) (sites P1))
)
(regions "Base" P1 {60})
(regions "Base" P2 {66})
Which is used to determine if player has reached their goal:
(end (if (is In (last To) ("EnemyBase")) (result Mover Win)))
Is there a simpler way?
I'm currently getting syntax errors trying to use the following code to determine if the piece being moved is named "Stone" (which has specific restrictions during a multi-hop movement):
(define "PieceIsStone"
(= (what at:(from)) (id "Stone" Mover))
)
The code is similar to a line used in Jungle.lud to determine if if an enemy "Elephant" piece is on a space (at least I think that's what it does):
// A rat can capture an elephant if it is not in the water first.
(and
(not (is In (from) (sites "Water")))
(= (what at:(to)) (id "Elephant" Next))
)
Again, is there a simpler way? Or a correct syntax?