For Jeff Roy: how to count tokens for... Log Out | Topics | Search
Moderators | Register | Edit Profile

Zillions of Games Discussion Forum » Designing Games for Zillions » For Jeff Roy: how to count tokens for win-conditions « Previous Next »

Author Message
Karl Scherer (Karl)
Posted on Saturday, November 17, 2001 - 9:16 pm:   

Jeff Roy wrote in the game text of his game
'ANNUVIN' :

"Under the official rules, a player also wins if he reduces his opponent to one piece without losing any of his own pieces (this addresses the fact that six pieces cannot quite cover the entire board). I couldn't figure out how to implement this, so the Zillions version doesn't include this rule."

Since you did not leave an email address in your zrf, I try to contact you through this discussion board. It might help other developers, too.

Here is my suggestion how to solve the problem:

For each of your 2x6 tokens,
6 for black and six for white keep an invisible
duplicate piece on an off-board position,
say with negative coordinates
(zw1 0 -11 0 -11),...,(zw6 0 -16 0 -16)
for the white pieces (let's call them 'wpiece') and
(zb1 0 -21 0 -21),...,(zb6 0 -26 0 -26)
for the black pieces (let's call them 'bpiece').

Connect each sequence with a direction, say 'e'.
Whenever a piece is captured, change the last of one (the one furthest East) of these duplicate pieces to another piece-type (say 'opiece').
Now all you have to do in the win-condition
is to check with a 'absolute-config' command
whether the corresponding pieces are still there or not.
For example, to check whether Black has one piece left you write

(and
(absolute-config (any-owner bpiece) (zb1))
(absolute-config (any-owner opiece) (zb2))
)

This code works for both White's and Black's
win-condition equally well.

I hope you get this message, Jeff and you
can amend your programm accordingly.
Try it out and tell me how it went
(karl@kiwi.gen.nz).

(And please add your email next time!!)

Happy programming!
Karl

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: