| Author |
Message |
Harry Harris (Harry)
| | Posted on Thursday, July 03, 2003 - 6:58 am: | |
Many thanks Jeff for help with the blocker piece. Another quick question... How do I create a piece that is not allowed to interpose to stop a check? I.e. it can only move if the king isn't under attack. I couldn't work out how to do this using 'attacked'. Cheers, Harry |
Karl Scherer (Karl)
| | Posted on Thursday, July 03, 2003 - 4:31 pm: | |
Hi Harry, I suppose all you desire is to know whether the king is under attack or not. For this just scan the board to find the king, then use "if attacked?..." Have you tried this? |
Harry Harris (Harry)
| | Posted on Thursday, July 03, 2003 - 4:43 pm: | |
Hi, no - I'm a newbie and don't know how to do it! I realise that if I could find the king I could use its position as an argument of 'attacked' - but how do I find the king?? Couldn't find 'locate' or 'scan' in the helpfile! Thanks, Harry |
Fergus Duniho (Fduniho)
| | Posted on Thursday, July 03, 2003 - 9:25 pm: | |
Give other pieces additional moves specifically for capturing the King, allowing each piece to leap any blocker piece that was moved on the last turn. Here's code for rider pieces: ($1 (while (or empty? (and last-to? (piece? blocker))) $1) (verify (and enemy? (piece? King))) add) If the blocker can also block a Knight leap, use this code for a Knight leap: ($1 (verify (or (not-piece? blocker) last-to?)) $1 (verify (and enemy? (piece? King))) add) Doing this will make it impossible for the blocker piece to move to block a check, because moving to block the check would still leave the King in check. It will not prevent a stationary blocker from blocking check, but I believe that is what you want. For the sake of minimizing the moves Zillions has to generate, you can remove redundancy by defining the other moves to not include any King captures, like so: For riders: ($1 (while empty? add $1) (verify (and not-friend? (not-piece? King)) add) For Knights: ($1 (verify (not-piece? blocker)) $1 (verify (and not-friend? (not-piece? King)) add) |
|