Dropping previously captured piece af... Log Out | Topics | Search
Moderators | Register | Edit Profile

Zillions of Games Discussion Forum » Designing Games for Zillions » Dropping previously captured piece after specific move « Previous Next »

Author Message
john gallez (Johngallez)
New member
Username: Johngallez

Post Number: 1
Registered: 3-2011
Posted on Monday, March 07, 2011 - 3:04 pm:   

In a game I created, when a specific piece moves into a square of the back rank of a standard chessboard, a previously captured piece is reclaimed and placed on any empty square. This secondary "move" is just a drop- the dropped piece may not move after the drop (until the next turn). I have been trying to figure out the best way to do this using add-partial or add-copy-partial and move-type along with zones and move-type restrictions. Another complication is that although a piece may be reclaimed for each square of the back rank that is moved into, this only happens on the first move into that square. I would be grateful for any suggestions regarding either the basic problem or the additional complication!
Malcolm James Webb (Mjw)
New member
Username: Mjw

Post Number: 2
Registered: 5-2008
Posted on Friday, April 15, 2011 - 10:34 pm:   

You could try a Shogi-style solution, modelled on the Shogi rules file that comes with Zillions:
A) Any piece that is "captured" is actually displaced to another square in a prison-zone: captured pieces should be actually visible to the side of the board (as in Shogi):

(define shift ($1 (verify not-friend?)
(prisoner-check)
(if (in-zone? back-rank-zone)
(add-partial reentry-moves) else add)))

(define prisoner-check
cascade mark (first-empty) to back))

(define first-empty
to-prison (while not-empty? next-prison))

You would need to modify the board description from the Shogi rules file.

B) Define a back-rank zone in the board description so that any move into that zone triggers entry of a piece. Also define a link "next" which would start from a1 and go all around the board in order.

C) With each piece, use move-type to define normal-moves and reentry-moves, and use either turn-order or move-priorities to stop the piece making a reentry-move as an initial move

D) Each piece would have moves (re-enter $1) in its moves list under (move-type reentry-moves), where $1 is one of the squares in the prison-zone
(define re-enter
((verify (in-zone? back-rank-zone))
$1 (verify friend?) from a1
(if empty? add)
(while on-board? (if empty? add) next)))

To deal with the additional complication, have a series of dummy positions linked to each of the squares of the back rank. Each of these dummy squares should contain a neutral dummy piece. Then on entry to the position, the piece must verify that the linked dummy square is not empty to generate the reentry move, and must capture that dummy piece when making the partial move.

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: