counting moves, keeping score Log Out | Topics | Search
Moderators | Register | Edit Profile

Zillions of Games Discussion Forum » Designing Games for Zillions » counting moves, keeping score « Previous Next »

Author Message
Patrick S. Duff (Pduff)
Posted on Tuesday, August 08, 2000 - 5:52 am:   

To start things off, here are some functions for counting moves, keeping score, counting how many pieces a move can capture, etc.. To keep this message short, I'll show how to implement a three-bit counter, but you can make it use as many bits as you need. Just add Counter-8, Counter-16, etc. following the same pattern shown here.

(define reset-counter
(set-flag Counter-1 false)
(set-flag Counter-2 false)
(set-flag Counter-4 false)
)

(define increment-counter
(set-flag Carry (flag? Counter-1))
(set-flag Counter-1 (not-flag? Counter-1))
(if (flag? Carry)
(set-flag Carry (flag? Counter-2))
(set-flag Counter-2 (not-flag? Counter-2))
)
(if (flag? Carry)
(set-flag Carry (flag? Counter-4))
(set-flag Counter-4 (not-flag? Counter-4))
) )

(define decrement-counter
(set-flag Counter-1 (not-flag? Counter-1))
(set-flag Carry (flag? Counter-1))
(if (flag? Carry)
(set-flag Counter-2 (not-flag? Counter-2))
(set-flag Carry (flag? Counter-2))
)
(if (flag? Carry)
(set-flag Counter-4 (not-flag? Counter-4))
(set-flag Carry (flag? Counter-4))
) )

(define counter-not-zero
(or (flag? Counter-1)
(flag? Counter-2)
(flag? Counter-4)
) )
Greg Schmidt (Gschmidt2)
New member
Username: Gschmidt2

Post Number: 144
Registered: 1-2007
Posted on Saturday, May 05, 2012 - 3:42 pm:   

Although it's doable, it really is a pain to implement scoring via ZRF programming. For many games where the score corresponds to a piece that is captured and the score values aren't very large, there is a simpler alternative. In that case, reserve an area of the board for captured pieces, one area for each player. When that area fills up, the game ends. The scoring pieces can be small tokens or miniatures of the pieces they represent. My game submission "Adaptoid" utilizes this techique.
Jose Carrillo (J_carrillo_vii)
New member
Username: J_carrillo_vii

Post Number: 9
Registered: 5-2008
Posted on Saturday, January 17, 2015 - 2:56 pm:   

I used the off the board (dummy) strategy to count moves, and while clumsy it works.

However, it messed (or exposed a bug with) the Repetition game ending goal. Since the dummy positions/pieces keep changing as the counting of moves changes, the Repetition goal no longer detects a 3-fold repetition condition. It appears that the Repetition goal is tracking changes to the off board pieces (this should not be the case according to the Zillions Rules Help File).

If I turn my counting functionality off, the the Repetition goal works again, as the dummy positions/pieces remain constant.

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: