That doesn't quite work, because leaps checks all four directions instead of just forwards and backwards. Maybe checkride shouldn't work either, but I tried it and it seems to.
This works for the Snake
def U fn (checkaride #0 #1 1 1 and empty #0)
where #0 0 1
#1
or fn (checkaride #0 #1 -1 1 and empty #0)
where #0 0 1
#1
or fn (checkaride #0 #1 1 1 and empty #0)
where #0 0 1
#1
or fn (checkaride #0 #1 -1 -1 and empty #0)
where #0 0 -1
#1
or fn (checkaride #0 #1 1 -1 and empty #0)
where #0 0 -1
#1
or checkaleap #0 #1 0 1
or checkaleap #0 #1 0 -1;
def UL mergeall
ray where #0 0 1 1 1
ray where #0 0 1 -1 1
ray where #0 0 -1 -1 -1
ray where #0 0 -1 1 -1
where #0 0 1
where #0 0 -1;
That doesn't quite work, because leaps checks all four directions instead of just forwards and backwards. Maybe checkride shouldn't work either, but I tried it and it seems to.
This works for the Snake