08-10-2020, 10:05 AM
A related question: what if I want to Hop over more than one piece in a line? I'm tyring my hand to implement Yinsh, where you have rings and discs and the rings can move in a straight line over any number of empty spaces (0-N), then over any number of discs (1-N), and stop at the first empty site after the discs.
I've tried doing this with the following rules, and it works for hopping over a single disc. When trying to extend it by adding a (range) clause to the (between) it results in no moves at all:
(move Hop
(between
before:10
//(range 1 10) // if this is enabled, no hops are generated!
after:0
if:(or
(= (what at:(between)) (id "Disc1"))
(= (what at:(between)) (id "Disc2"))
)
(apply ("Flip"))
)
(to if:(is Empty at:(to)))
)
PS. Could you please add some notes to the reference manual about which ludemes set which context values, and what scope the context values have? I ran into some trouble using the (forEach Site ...) rule expecting the context for the current site looped over to be (site) when it's actually using the (to) context. Took me a bit of banging my head into the wall until I figured that one out!
I've tried doing this with the following rules, and it works for hopping over a single disc. When trying to extend it by adding a (range) clause to the (between) it results in no moves at all:
(move Hop
(between
before:10
//(range 1 10) // if this is enabled, no hops are generated!
after:0
if:(or
(= (what at:(between)) (id "Disc1"))
(= (what at:(between)) (id "Disc2"))
)
(apply ("Flip"))
)
(to if:(is Empty at:(to)))
)
PS. Could you please add some notes to the reference manual about which ludemes set which context values, and what scope the context values have? I ran into some trouble using the (forEach Site ...) rule expecting the context for the current site looped over to be (site) when it's actually using the (to) context. Took me a bit of banging my head into the wall until I figured that one out!