Need help converting all enemy pieces... Log Out | Topics | Search
Moderators | Register | Edit Profile

Zillions of Games Discussion Forum » Designing Games for Zillions » Need help converting all enemy pieces to friendly pieces « Previous Next »

Author Message
Michael Strickland (Michael)
Posted on Friday, May 16, 2003 - 2:58 pm:   

Hi
I'm writing a .zrf for Chess of the Four Seasons
(a Spanish four player variant), and I'm having trouble having Zillions convert all enemy pieces of a certain color to friendly pieces after capturing their king.

The problem is when I capture green or black's King it converts their pieces AND yellow's. The other problem is when I capture yellow's king no pieces are converted.

Here is an example of the macros I'm using:

(define flip-all
a1 (if $1 change-owner (set-attribute $1 false) (set-attribute $2 true))
(while (on-board? next) next
(if $1 change-owner (set-attribute $1 false) (set-attribute $2 true))
)
)

(define addd
(if (not-piece? King) add
else
mark
(if (in-zone? Play-zone Red-pos)
(if green? Green-pos capture (flip-all green? red?))
(if black? Black-pos capture (flip-all black? red?))
(if yellow? Yellow-pos capture (flip-all yellow? red?))
))

I would greatly appreciate some help with this.
Dan Troyka (Dtroyka)
Posted on Friday, May 16, 2003 - 4:13 pm:   

Try nesting your [color]? tests as follows:

(if green? Green-pos capture (flip-all green? red?) else
(if black? Black-pos capture (flip-all black? red?) else
(if yellow? Yellow-pos capture (flip-all yellow? red?))))

Under the current macro, it appears that if a green or black King is captured the flip-all macro stops scanning on a square other than the marked square (presumably the upper right square). If this position contains a yellow piece, then the yellow? test returns true and yellow pieces are flipped as well.

This wouldn't explain why the yellow pieces aren't converted when the yellow King is captured.
Michael Strickland (Michael)
Posted on Friday, May 16, 2003 - 7:20 pm:   

Thank you very much, that fixed the problem!

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: