Using the attacked? code? Log Out | Topics | Search
Moderators | Register | Edit Profile

Zillions of Games Discussion Forum » Designing Games for Zillions » Using the attacked? code? « Previous Next »

Author Message
Chris Huntoon (Chrish)
Posted on Tuesday, January 30, 2001 - 5:54 am:   

I'm working on on chess variant where the king has a special "escape" maneuver it can use, but only when it is in check.

The problem is verifying the king is in check before allowing use of the move. I've tried using both "if attacked?" and "verify attacked?" codes but keeping getting parse errors.

Any help would be appreciated.
Jeff Mallett (Jeffm)
Posted on Tuesday, January 30, 2001 - 11:23 pm:   

Hmmm... I just tried this and it worked fine.

Perhaps something else is wrong... are you able to make your ZRF so having "attacked?" gives you a parse error but when you replace that one word with, say "friend?", it will not give you a parse error?
Chris Huntoon (Chrish)
Posted on Thursday, February 01, 2001 - 6:27 pm:   

I think the root of the problem is that the King is the piece generating the move while having to check its own status. The attacked? code seems to work fine when checking the status of a different piece in relation to the King, but not when checking the King's own status. How do I get around this?
Dan Troyka (Dtroyka)
Posted on Friday, February 02, 2001 - 8:03 pm:   

I tried inserting a (verify attacked?) into the king-shift macro in the chess rules file and it worked fine. The revised macro is:

(define king-shift ((verify attacked?) $1 (verify not-friend?) (set-attribute never-moved? false) add))

The king only moves when in check. I suspect the problem you're facing is some other part of the move code. Perhaps you could post it.
Jeff Mallett (Jeffm)
Posted on Saturday, February 03, 2001 - 1:14 pm:   

I tried adding a new move to the end of the King piece's moves:

((verify attacked?) n n (verify not-friend?) add)

to allow the King to jump 2 moves ahead when checked. This also worked perfectly.

You'll need to track this down to what is causing the problem if you want us to have a chance at helping you. Also, what is the error you are getting?
Chris Huntoon (Chrish)
Posted on Sunday, February 04, 2001 - 9:30 am:   

Well I see now that it was simply having the ) in the wrong place in the definition. Although I tried adjusting this before, there must have been something else wrong because I still kept getting parse errors. But everything works fine now.

Thanks for all the help.

Add Your Message Here
Post:
Username: Posting Information:
This is a private posting area. Only registered users and moderators may post messages here.
Password:
Options: Enable HTML code in message
Automatically activate URLs in message
Action: