Check out Janggi (Korean Chess), our featured variant for December, 2024.


[ Help | Earliest Comments | Latest Comments ]
[ List All Subjects of Discussion | Create New Subject of Discussion ]
[ List Earliest Comments Only For Pages | Games | Rated Pages | Rated Games | Subjects of Discussion ]

Single Comment

ZRF question[Subject Thread] [Add Response]
🕸Fergus Duniho wrote on Thu, Nov 6, 2003 12:33 AM UTC:
Peter's idea is a good one, but he left out part. The next direction used
in the macro presumes that all spaces on the board have been linked
together with the next direction, and a1 is the first position on the
board. If your ZRF didn't already have this set up, you would have to set
it up before this macro would work.

The OFF position would be defined as a position after the end of the 
board. Here is a macro that would work just as well and is more optimized.

(define Pawn-Win (
   (verify (in-zone? king-capture))
   a1 
   (while (and (not-piece? King) not-enemy?) next)
   add
))

There is no need to check for OFF or even for (on-board? next) -- unless
you loop the whole board back to front, which you don't need to do. A 
while loop stops once the end of the board is reached. Besides this, the 
assumption is that the King is always on the board, and so the King would 
be reached before the while loop went off the board.