Help with Distance Captures Log Out | Topics | Search
Moderators | Register | Edit Profile

Zillions of Games Discussion Forum » Designing Games for Zillions » Help with Distance Captures « Previous Next »

Author Message
Chris Strong (Cstrong)
New member
Username: Cstrong

Post Number: 1
Registered: 1-2012
Posted on Monday, January 02, 2012 - 11:27 pm:   

I am trying to describe a capture rule such that certain enemy pieces are eliminated just by
being in the range of movement of an orthagonally moving piece (e.g. rook). That is, this
rook captures not by displacement, but simply by "seeing" some types of its enemies. Note
this can result in multiple captures. This is my attempt at scripting this move:

'''
(piece LethalRook
...
(moves
(move-type standard-moves)
...
(move-type distance-captures)
(OrthagonalSight n)
(OrthagonalSight w)
(OrthagonalSight e)
(OrthagonalSight s)
add
)

...
)

...

(define OrthagonalSight
( while (and on-board? empty?) $1 )
(if on-board?
(if (or (piece? piece-type1) (piece? piece-type2) capture)
)
back
)

(game

...

(turn-order (White distance-captures) (White standard-moves) Black )
...

)


... and this does not work at all (no distance captures are occurring)
although there are no syntax errors called out and the pieces are otherwise moving correctly.
Can anyone see what I am doing wrong?
Greg Schmidt (Gschmidt2)
New member
Username: Gschmidt2

Post Number: 139
Registered: 1-2007
Posted on Tuesday, January 03, 2012 - 2:27 pm:   

One problem I see is that you have a single "add" at the end of all moves. You need one "add" per move that's generated, not a single "add" for all moves. I think you will need to move the "add" to your "OrthagonalSight" macro following the "capture". If it helps, take a look at Chess.zrf for an example of macros which add moves.
Chris Strong (Cstrong)
New member
Username: Cstrong

Post Number: 2
Registered: 1-2012
Posted on Tuesday, January 03, 2012 - 9:27 pm:   

Hi, Greg, thanks for taking a look at this. Your comment has got me thinking. I had only one add for the four move macros because I was specifying the simultaneous capture of pieces potentially in all four directions. I was thinking an add at the end of the OrthagonalView define would tell
Zillions to make only one of the four captures, which is not what I want. So, with the add at the end of all 4 macros, I am locating enemy pieces in all 4 directions, simultaneously capturing them as appropriate, and then "back"ing up the focus to the LethalRook's original position. Now it dawns on me that when I do invoke the add, the location of the focus also tells Zillions to move LethalRook to the square it is already standing on. Could that be what is causing Zillions heartburn?
Greg Schmidt (Gschmidt2)
New member
Username: Gschmidt2

Post Number: 140
Registered: 1-2007
Posted on Wednesday, January 04, 2012 - 9:46 am:   

Hi Chris. Sorry, after reading your response and talking another look, I agree that a single "add" is what you want. Now that you mention it, I don't see where you've defined the rook movement itself, just the capture behavior so I could easily see that being a problem. Perhaps, it would be better to start with working rook move code first, then "layer on" the captures to that.
Chris Strong (Cstrong)
New member
Username: Cstrong

Post Number: 3
Registered: 1-2012
Posted on Wednesday, January 04, 2012 - 6:28 pm:   

Yeah, I think that (no LethalRook move) is the problem. The thing is, the captures are supposed to occur at the beginning of its turn, before the LethalRook moves - so the other side can duck the distance capture threats. This is the reason I dedicated an extra turn for distance-capture. What I am planning to do now is add another piece, say the "Red-Herring", that shuttles between two off board spaces "ping" and "pong", and with each move I will have to find the LethalRooks, apply the OrthagonalView macros, and *then* "add". This is pretty hokey. Can you think of a more elegant way to capture without moving?
Thanks again for helping me out with this problem.
p.s. -
I think ZoG is a great application. I have spent more time than I care to say playing the Tamerlane's Chess variant.
Greg Schmidt (Gschmidt2)
New member
Username: Gschmidt2

Post Number: 141
Registered: 1-2007
Posted on Wednesday, January 04, 2012 - 10:19 pm:   

Check out the topic "The Internals of Movement" in the help file. There it lists the order in which move primitives are processed and captures occur last. I suppose you could move the rook, then distance-capture the pieces with respect to the "from" position of the piece if that makes sense. Yes, Zillions is pretty incredible :-)
M Winther (Kalroten)
New member
Username: Kalroten

Post Number: 151
Registered: 1-2007
Posted on Saturday, January 21, 2012 - 2:06 am:   

Perhaps you could have a look at my implementation of Coordinator Chess where pieces are captured at distance. I use a "gaze" move type.
http://hem.passagen.se/melki9/coordinatorchess.htm

/Mats

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: