(not-attacked? <move-type> <position>... Log Out | Topics | Search
Moderators | Register | Edit Profile

Zillions of Games Discussion Forum » Designing Games for Zillions » (not-attacked? <move-type> <position>) « Previous Next »

Author Message
John Talbot (Jochta)
Posted on Friday, March 21, 2003 - 10:57 am:   

Why can't I get this position condition to work? For example...

(if (not-attacked? normal-move e8) add)

leads to a parse error at e8

or...

(verify (not-attacked? normal-move))

is OK, but...

(verify (not-attacked? normal-move e8))

is not.

Any help appreciated, thanks.

John
David Eugene Whitcher (Dralius)
Posted on Monday, March 24, 2003 - 7:38 am:   

Dear John

It depends on what you are trying to do. I am assuming the following.

1. Checking that the position is not attacked.

2. normal-move is a simple macro like
( define normal-move ( $1 ( verify empty? ) add ) )

3.Then move to position e8

I may be confused but i think this will do it. Let me know if it works for you.

( (verify not-attacked? ) normal-move e8 )

Dralius
John Talbot (Jochta)
Posted on Monday, March 24, 2003 - 10:04 am:   

Hmm, that didn't work. I'm experimenting with an idea, see below...

What I have is an attacking move. I want to make sure the King cannot move into a normal check but it can move into the influence of the attacking move (I don't want to use a checkmate goal because it prevents the blunder moves).

So I set up a set of normal-move which are never played (this is set in turn-order) but are checked before a King moves like so.

(define king-shift ($1 (verify empty?) (if (not-attacked? normal-move) (set-attribute never-moved? false) add)) )

This works fine. Now what I'm trying to do is to make sure you don't play a move which puts your King into normal check, hence

(if (not-attacked? normal-move e8) add)

in the attacking move definitions.

e8 being the current position of the King (this is just an example). The help file suggests that this construct is OK but it will not compile.

John
David Eugene Whitcher (Dralius)
Posted on Wednesday, March 26, 2003 - 12:48 pm:   

I should have tested it first. What do you mean by "normal check"? I am not familiar with that term. All i know is "check" when your king can be attacked and "mate" when you can't get out of check. Are you looking to allow moves into check but still have checkmate be the winning condition?
Dan Troyka (Dtroyka)
Posted on Wednesday, March 26, 2003 - 7:26 pm:   

Try the syntax:

(verify (not (attacked? normal-move e8)))

This is equivalent to using not-attacked? and it appears to work.
John Talbot (Jochta)
Posted on Thursday, March 27, 2003 - 3:39 am:   

Dan - great that worked. Must be a bug?

David - the way I'm setting up my game you can move into "check" under influence of the attacking move, but you can't move into the standard definition of check i.e. attacked directly as in normal chess. Yeah I know that's kind of stupid, but it makes sense honestly!

Thanks for the help.

John
Peter Aronson (Peteraronson)
Posted on Thursday, March 27, 2003 - 4:15 pm:   

It is a bug -- I've run into it too. I've always meant to report it, but since the workaround is so easy, I've never bothered.

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: