11-09-2021, 11:44 PM
(This post was last modified: 11-13-2021, 07:59 PM by sharmoni.
Edit Reason: added source reference
)
I want to prevent moveAgain being available if a capture occurs during a multi-hop move sequence. What is the correct syntax to check if a capture happened after a move?
functioning code:
syntax error code:
I'm trying to check for a capture after the (to part of a hop move. The capture/piece removal seems to be happening automatically (maybe a default?) so at that point in the code I'm not sure there is even an enemy piece to check.
This code is modified from Camelot.lud
functioning code:
Code:
(define "ColumnMoveAgainAfterJumping" (and (moveAgain) (set Pending)) )
syntax error code:
Code:
(define "ColumnMoveAgainAfterJumping"
(or
(is Enemy (who at:(to))) <-- this is the error line
(and (moveAgain) (set Pending))
)
)
I'm trying to check for a capture after the (to part of a hop move. The capture/piece removal seems to be happening automatically (maybe a default?) so at that point in the code I'm not sure there is even an enemy piece to check.
Code:
("ColumnHopSequence" (from) "OnAFriend" "ColumnMoveAgainAfterJumping")
(define "ColumnHop"
(move
Hop
(from #1)
#2
(to if:(and "EmptyOrEnemyOccupied" (not (is Visited (to)))))
#3
)
)
(define "ColumnHopSequence"
("ColumnHop"
#1
#2
(then
(if
(can Move ("ColumnHop" (last To) #2))
#3
)
)
)
)
This code is modified from Camelot.lud