[ List Earliest Comments Only For Pages | Games | Rated Pages | Rated Games | Subjects of Discussion ]
Single Comment
Since the Tiger has an extra challenge, I thought I would try it too. The following code has been tested to work on an empty 16x16 board and with various positions blocked.
def Tiger
checkride #ts #1 1 1
and checkride #0 #ts 1 0
and empty #ts
=ts where #0
* 3 * sign #fd == abs #rd #n
* 3 * sign #rd == abs #fd #n
and == #n min abs #fd abs #rd
=fd - file #1 file #0
=rd - rank #1 rank #0
=n - #d 3
and > #d 3
or and checkride #0 #1 1 0 <= #d 3
=d distance #0 #1
or fn Elephant #0 #1;
The challenge was in figuring out how to avoid checking two different Bishop moves. This meant figuring out the precise value for ts instead of testing two possible values for it. Within each quadrant, each possible destination could be defined as a variation on either (n, n+3) or (n+3, n). The variations would include -n or -(n+3). To get the precise value for ts, I had to identify the quadrant and which form the destination had. I could identify the quadrant through the sign of fd and rd, and I could identify the form by checking whether rd or fd had an absolute value equal to n.