I managed to find a way to describe the correct moves for hook moving pieces in the large Shogi variants. An example ludeme is attached for easier reference.
The updated code (not including promotion rules) is shown below.
(piece "HookMover" Each ("HookMove" Orthogonal Orthogonal)) // Orthogonal hook mover
(piece "Capricorn" Each ("HookMove" Diagonal Diagonal)) // Diagonal hook mover
(piece "Tengu" Each (or ("HookMove" Diagonal Diagonal) ("StepMove" Orthogonal))) // Compound
(piece "Peacock" Each (or ("HookMove" Diagonal Diagonal) ("SlideMove" (directions {BR BL}) (between (max 2))))) // Compound
(define "HookMove"
(or {
("SlideMove" #1 #3)
("HookMoveIteration" #1 #2 (exact 1) #3)
("HookMoveIteration" #1 #2 (exact 2) #3)
("HookMoveIteration" #1 #2 (exact 3) #3)
...
// One iteration for each possible distance (from 1 to [length of longest board dimension - 1])
...
("HookMoveIteration" #1 #2 (exact 35) #3) // 1-35 for Taikyoku Shogi
})
)
(define "HookMoveIteration"
(forEach Direction
#1
(between (min 1) if:(is Empty (between))) // emulate slide
(to
if:(is Empty (to)) // Exclude tack changes on occupied squares
(apply
(forEach Direction
(from (to))
(difference (difference #2 (directions Cell from:(from) to:(to))) (directions Cell from:(to) to:(from))) // Exclude directions along same line as initial slide
(between #3 if:(is Empty (between)))
(if (not ("IsFriendAt" (to))) // Allow capture after changing tack
(move
(from)
(to
("CapturePiece")
)
)
)
)
)
)
#4
)
)
The updated code (not including promotion rules) is shown below.
(piece "HookMover" Each ("HookMove" Orthogonal Orthogonal)) // Orthogonal hook mover
(piece "Capricorn" Each ("HookMove" Diagonal Diagonal)) // Diagonal hook mover
(piece "Tengu" Each (or ("HookMove" Diagonal Diagonal) ("StepMove" Orthogonal))) // Compound
(piece "Peacock" Each (or ("HookMove" Diagonal Diagonal) ("SlideMove" (directions {BR BL}) (between (max 2))))) // Compound
(define "HookMove"
(or {
("SlideMove" #1 #3)
("HookMoveIteration" #1 #2 (exact 1) #3)
("HookMoveIteration" #1 #2 (exact 2) #3)
("HookMoveIteration" #1 #2 (exact 3) #3)
...
// One iteration for each possible distance (from 1 to [length of longest board dimension - 1])
...
("HookMoveIteration" #1 #2 (exact 35) #3) // 1-35 for Taikyoku Shogi
})
)
(define "HookMoveIteration"
(forEach Direction
#1
(between (min 1) if:(is Empty (between))) // emulate slide
(to
if:(is Empty (to)) // Exclude tack changes on occupied squares
(apply
(forEach Direction
(from (to))
(difference (difference #2 (directions Cell from:(from) to:(to))) (directions Cell from:(to) to:(from))) // Exclude directions along same line as initial slide
(between #3 if:(is Empty (between)))
(if (not ("IsFriendAt" (to))) // Allow capture after changing tack
(move
(from)
(to
("CapturePiece")
)
)
)
)
)
)
#4
)
)