01-29-2021, 05:55 AM
I got most of the way through implementing Spartan Chess. However I am finding that (is Threatened....) is not coming out correctly. I attach the .lud and a trial.
Using the Test Ludeme dialog. I would expect that that (is Threatened at:12) should return true, because the Lieutenant at 26 can capture the White King at 12. However it comes out as false as indicated by the fact that White has many more legal moves than it should. In particular Ludii is not requiring White to move the King out of danger.
The expanded code for the Lieutenant is:
Using the Test Ludeme dialog. I would expect that that (is Threatened at:12) should return true, because the Lieutenant at 26 can capture the White King at 12. However it comes out as false as indicated by the fact that White has many more legal moves than it should. In particular Ludii is not requiring White to move the King out of danger.
The expanded code for the Lieutenant is:
Code:
(piece "Lieutenant"
P2
(or
{
(move
Step
Diagonal
(to
if:(or
(is Empty (to))
(is Enemy (who at:(to)))
)
(apply
(if
(is Enemy (who at:(to)))
(remove (to) (then (set Counter)))
)
)
)
)
(move
Hop
Diagonal
(to
if:(or
(is Enemy (who at:(to)))
(is Empty (to))
)
(apply
(if
(is Enemy (who at:(to)))
(remove (to) (then (set Counter)))
)
)
)
)
(move
Step
(directions { W E })
(to if:(is Empty (to)))
)
}
)
)