Winning Loss Combination? Log Out | Topics | Search
Moderators | Register | Edit Profile

Zillions of Games Discussion Forum » Designing Games for Zillions » Winning Loss Combination? « Previous Next »

Author Message
Sean Duggan (Dream)
Posted on Monday, January 17, 2005 - 1:32 pm:   

I'm trying to build Zhadu (http://wiki.atitd.net/tale2/Test_Of_Zhadu). I've actually got everything written right now. The problem which I'm running into is that the way I have things set up, the computer plays over-cautiously until the 3-turn limit for draw is reached. For those not wanting to peruse the rules too deeply, the game is won by having your first and last capture sum to 4. Since there are pieces from 1 to 4, and one piece that can move 1,2, or 3, that means there's a certain number of combinations that can win. First capture being a 4. Combination of 1 and 3, 1 and 123, 3 and 123, or 2 and 123. I've got those set up and tested. The only problem is that the computer avoids all conflict, resulting in a 3-move repition draw when against itself. I've tried coding the win-dondition as either a win-condition or a loss-condition and the result is the same either way. Right now, I'm suspect it's perhaps a function of the partial moves (since a piece can change direction at any time, I've got something like the 3-piece set up as 3 partial moves) overloading the logic, so I'll try to fix it up without those. (Which will be messy and probably require a computer to generate that part of my ZRF file...) Anyhow, I thought I'd post the issue and see if I got any replies.
Sean Duggan (Dream)
Posted on Monday, January 17, 2005 - 1:33 pm:   

Code:
(game
(title "Zhadu")
; description, history and strategy omitted to save space.
(players White Black)
(turn-order White Black)
(move-priorities Drop FourthMove ThirdMove SecondMove FirstMove)
(board
(image "images\Zhadu\ZhaduEmpty.bmp")
(dummy Counter1 Counter2 Counter3 Counter4) ; For counting down moves.
(positions
(T1A 35 167 79 211)
(T1B 115 122 159 166)
(T1C 115 211 159 255)
(T1D 88 166 132 210)

(T2A 194 76 238 120)
(T2B 274 31 318 75)
(T2C 274 120 318 164)
(T2D 247 75 291 119)

(T3A 194 256 238 300)
(T3B 274 211 318 255)
(T3C 274 300 318 344)
(T3D 247 255 291 299)

(T4A 352 164 396 208)
(T4B 432 119 476 163)
(T4C 432 208 476 252)
(T4D 405 163 449 207)

(T5A 246 165 290 209)
(T5B 166 120 210 164)
(T5C 166 209 210 253)
(T5D 193 164 237 208)

(T6A 403 74 447 118)
(T6B 323 29 367 73)
(T6C 323 118 367 162)
(T6D 350 73 394 117)

(T7A 403 254 447 298)
(T7B 323 209 367 253)
(T7C 323 298 367 342)
(T7D 350 253 394 297)

(T8A 562 162 606 206)
(T8B 482 117 526 161)
(T8C 482 206 526 250)
(T8D 509 161 553 205)

(WhiteCapture1 35 35 79 79)
(WhiteCapture2 100 35 144 79)
(BlackCapture1 496 321 540 365)
(BlackCapture2 561 321 605 365)
)

(zone
(name startZone)
(players White)
(positions T1A T1B T1C T1D T5D)
)

(zone
(name startZone)
(players Black)
(positions T8A T8B T8C T8D T4D)
)

(zone
(name captureZone)
(players White)
(positions WhiteCapture1 WhiteCapture2)
)
(zone
(name captureZone)
(players Black)
(positions BlackCapture1 BlackCapture2)
)

(zone
(name captureZone1)
(players White)
(positions WhiteCapture1)
)
(zone
(name captureZone1)
(players Black)
(positions BlackCapture1)
)

(links ab
(T1A T1B) (T2A T2B) (T3A T3B) (T4A T4B) (T5A T5B) (T6A T6B) (T7A T7B) (T8A T8B)
(T1B T1A) (T2B T2A) (T3B T3A) (T4B T4A) (T5B T5A) (T6B T6A) (T7B T7A) (T8B T8A)
)

(links ac
(T1A T1C) (T2A T2C) (T3A T3C) (T4A T4C) (T5A T5C) (T6A T6C) (T7A T7C) (T8A T8C)
(T1C T1A) (T2C T2A) (T3C T3A) (T4C T4A) (T5C T5A) (T6C T6A) (T7C T7A) (T8C T8A)
)

(links ad
(T1A T1D) (T2A T2D) (T3A T3D) (T4A T4D) (T5A T5D) (T6A T6D) (T7A T7D) (T8A T8D)
(T1D T1A) (T2D T2A) (T3D T3A) (T4D T4A) (T5D T5A) (T6D T6A) (T7D T7A) (T8D T8A)
)

(links bc
(T1B T1C) (T2B T2C) (T3B T3C) (T4B T4C) (T5B T5C) (T6B T6C) (T7B T7C) (T8B T8C)
(T1C T1B) (T2C T2B) (T3C T3B) (T4C T4B) (T5C T5B) (T6C T6B) (T7C T7B) (T8C T8B)
)

(links bd
(T1B T1D) (T2B T2D) (T3B T3D) (T4B T4D) (T5B T5D) (T6B T6D) (T7B T7D) (T8B T8D)
(T1D T1B) (T2D T2B) (T3D T3B) (T4D T4B) (T5D T5B) (T6D T6B) (T7D T7B) (T8D T8B)
)

(links cd
(T1C T1D) (T2C T2D) (T3C T3D) (T4C T4D) (T5C T5D) (T6C T6D) (T7C T7D) (T8C T8D)
(T1D T1C) (T2D T2C) (T3D T3C) (T4D T4C) (T5D T5C) (T6D T6C) (T7D T7C) (T8D T8C)
)

(links across1
; --
(T1B T5B) (T1C T5C) (T2B T6B) (T2C T6C) (T3B T7B) (T3C T7C) (T4B T8B) (T4C T8C)
(T5B T1B) (T5C T1C) (T6B T2B) (T6C T2C) (T7B T3B) (T7C T3C) (T8B T4B) (T8C T4C)
)
(links across2
; /
(T2A T5B) (T2C T5A) (T4A T7B) (T4C T7A)
(T5B T2A) (T5A T2C) (T7B T4A) (T7A T4C)
)
(links across3
; \
(T5C T3A) (T5A T3B) (T6C T4A) (T6A T4B)
(T3A T5C) (T3B T5A) (T4A T6C) (T4B T6A)
)
)

; Moves are going to require a move-partial


(define DoCapture
(if (empty? $1Capture1)
$1Capture1
(create $2)
add
else
$1Capture2
(create $2)
add
)
)

(define CaptureCode
(if (piece? One)
(DoCapture $1 One)
else
(if (piece? Two)
(DoCapture $1 Two)
else
(if (piece? Three)
(DoCapture $1 Three)
else
(if (piece? Four)
(DoCapture $1 Four)
else
(DoCapture $1 OneThree)
)
)
)

)
)

(define PieceMove1
(
$1
(if enemy?
cascade
(if (in-zone? startZone T1A) (CaptureCode White) else (CaptureCode Black))
)
(verify empty?)
add
)
)

(define PieceMove2
(
$1
(verify empty?)
(add-partial FirstMove)
)
)

(define PieceMove3
(
$1
(verify empty?)
(add-partial SecondMove)
)
)
(define PieceMove4
(
$1
(verify empty?)
(add-partial ThirdMove)
)
)

(piece
(name One)
(help "One: Moves one space")
(image White "images\Zhadu\OnePieceBlack.bmp"
Black "images\Zhadu\OnePieceBlack.bmp")
(drops (move-type Drop) ((verify (in-zone? startZone))(verify empty?) add))
(moves
(move-type FourthMove)
(PieceMove1 ab) (PieceMove1 ac) (PieceMove1 ad) (PieceMove1 bc) (PieceMove1 bd) (PieceMove1 cd)
(PieceMove1 across1) (PieceMove1 across2) (PieceMove1 across3)
)
)
(piece
(name Two)
(help "Two: Moves two spaces")
(image White "images\Zhadu\TwoPieceBlack.bmp"
Black "images\Zhadu\TwoPieceBlack.bmp")
(drops (move-type Drop) ((verify (in-zone? startZone))(verify empty?) add))
(moves
(move-type FourthMove)
(PieceMove2 ab) (PieceMove2 ac) (PieceMove2 ad) (PieceMove2 bc) (PieceMove2 bd) (PieceMove2 cd)
(PieceMove2 across1) (PieceMove2 across2) (PieceMove2 across3)
(move-type FirstMove)
(PieceMove1 ab) (PieceMove1 ac) (PieceMove1 ad) (PieceMove1 bc) (PieceMove1 bd) (PieceMove1 cd)
(PieceMove1 across1) (PieceMove1 across2) (PieceMove1 across3)
)
)
(piece
(name Three)
(help "Three: Moves three spaces")
(image White "images\Zhadu\ThreePieceBlack.bmp"
Black "images\Zhadu\ThreePieceBlack.bmp")
(drops (move-type Drop) ((verify (in-zone? startZone))(verify empty?) add))
(moves
(move-type FourthMove)
(PieceMove3 ab) (PieceMove3 ac) (PieceMove3 ad) (PieceMove3 bc) (PieceMove3 bd) (PieceMove3 cd)
(PieceMove3 across1) (PieceMove3 across2) (PieceMove3 across3)
(move-type SecondMove)
(PieceMove2 ab) (PieceMove2 ac) (PieceMove2 ad) (PieceMove2 bc) (PieceMove2 bd) (PieceMove2 cd)
(PieceMove2 across1) (PieceMove2 across2) (PieceMove2 across3)
(move-type FirstMove)
(PieceMove1 ab) (PieceMove1 ac) (PieceMove1 ad) (PieceMove1 bc) (PieceMove1 bd) (PieceMove1 cd)
(PieceMove1 across1) (PieceMove1 across2) (PieceMove1 across3)
)
)

(piece
(name Four)
(help "Four: Moves four spaces")
(image White "images\Zhadu\FourPieceBlack.bmp"
Black "images\Zhadu\FourPieceBlack.bmp")
(drops (move-type Drop) ((verify (in-zone? startZone))(verify empty?) add))
(moves
(move-type FourthMove)
(PieceMove4 ab) (PieceMove4 ac) (PieceMove4 ad) (PieceMove4 bc) (PieceMove4 bd) (PieceMove4 cd)
(PieceMove4 across1) (PieceMove4 across2) (PieceMove4 across3)
(move-type ThirdMove)
(PieceMove3 ab) (PieceMove3 ac) (PieceMove3 ad) (PieceMove3 bc) (PieceMove3 bd) (PieceMove3 cd)
(PieceMove3 across1) (PieceMove3 across2) (PieceMove3 across3)
(move-type SecondMove)
(PieceMove2 ab) (PieceMove2 ac) (PieceMove2 ad) (PieceMove2 bc) (PieceMove2 bd) (PieceMove2 cd)
(PieceMove2 across1) (PieceMove2 across2) (PieceMove2 across3)
(move-type FirstMove)
(PieceMove1 ab) (PieceMove1 ac) (PieceMove1 ad) (PieceMove1 bc) (PieceMove1 bd) (PieceMove1 cd)
(PieceMove1 across1) (PieceMove1 across2) (PieceMove1 across3)
)
)

(define NullMove
(
(set-flag my-flag true)

add
)
)

(piece
(name OneThree)
(help "OneThree: Moves one to three spaces\click once to end move.")
(image White "images\Zhadu\OneThreePieceBlack.bmp"
Black "images\Zhadu\OneThreePieceBlack.bmp")
(drops (move-type Drop) ((verify (in-zone? startZone))(verify empty?) add))
(moves
(move-type FourthMove)
(PieceMove3 ab) (PieceMove3 ac) (PieceMove3 ad) (PieceMove3 bc) (PieceMove3 bd) (PieceMove3 cd)
(PieceMove3 across1) (PieceMove3 across2) (PieceMove3 across3)
(move-type SecondMove)
(PieceMove2 ab) (PieceMove2 ac) (PieceMove2 ad) (PieceMove2 bc) (PieceMove2 bd) (PieceMove2 cd)
(PieceMove2 across1) (PieceMove2 across2) (PieceMove2 across3) (NullMove)
(move-type FirstMove)
(PieceMove1 ab) (PieceMove1 ac) (PieceMove1 ad) (PieceMove1 bc) (PieceMove1 bd) (PieceMove1 cd)
(PieceMove1 across1) (PieceMove1 across2) (PieceMove1 across3) (NullMove)
)
)


(board-setup
(White
(One off 1)
(Two off 1)
(Three off 1)
(Four off 1)
(OneThree off 1)
)
(Black
(One off 1)
(Two off 1)
(Three off 1)
(Four off 1)
(OneThree off 1)
)
)


(win-condition (White Black)
(or
(and
(absolute-config One (captureZone))
(or
(absolute-config Three (captureZone))
(absolute-config OneThree (captureZone))
)
)
(and
(absolute-config Three (captureZone))
(absolute-config OneThree (captureZone))
)
(and
(absolute-config Two (captureZone))
(absolute-config OneThree (captureZone))
)

(absolute-config Four (captureZone1))
)

)
)
L. Lynn Smith (Interrupt27)
Posted on Tuesday, January 18, 2005 - 10:55 am:   

I have already written a ZRF for Zhadu. Check the official site for the implementation.
L. Lynn Smith (Interrupt27)
Posted on Tuesday, January 18, 2005 - 11:35 am:   

Since it appears that the official Zhadu site is not quite operational, I've submitted a copy of this ZRF to the Zillions site.

I was able to code using the proper notation, and the pieces are able to preform their moves without having to make multi-steps. The win-conditions are also honored.

The implementation has been titled 'the un-official version' at the request of the game's designer.

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: