Neutral Pieces Log Out | Topics | Search
Moderators | Register | Edit Profile

Zillions of Games Discussion Forum » Designing Games for Zillions » Neutral Pieces « Previous Next »

Author Message
Charles Kayser (Whosasking)
Posted on Wednesday, October 15, 2003 - 10:57 am:   

I am in the middle of constructing a game that invovles the following move logic.

During your turn, you can perform one of two things:
1. Drop a piece of your color onto an empty section of board.
2. Take any piece (even an opponent's) and move it one space orthogonally (wraparound included). Doing so causes every piece along that row or column (depending on the move) to move accordingly, creating a "slide" move.

The object of this is to create a complete row, column, or diagonal of your color, either by simply dropping them into place or by sliding such a configuration into place.

Now, I have the drop and the slide logic down thanks to special directions and move cascades. My only stumbling block is that I can't figure out how to allow a player to move an opponent's piece to initiate a slide. Does anyone have any suggestions for such a maneuver?
Dan Troyka (Dtroyka)
Posted on Thursday, October 16, 2003 - 8:22 am:   

You can use "from" on an enemy piece to move it. E.g., create an off-board dummy piece that locates an enemy piece, designates its position as the "from" square, then slides it one space. Since you are using cascade you would probably need to have separate move blocks for each enemy piece. Or if you are feeling adventurous you could try the "discard cascades" feature from Zillions 2.0.
Charles Kayser (Whosasking)
Posted on Thursday, October 16, 2003 - 10:56 am:   

I already discard cascades to keep things clean, so that's not the problem. But you may want to explain to me how I could use the dummy piece technique to enable me to move an arbitrary enemy piece. From what I've studied of other neutral piece games, there are a number of ways to do it, but they're all complicated, and there could be a lot of enemy pieces on the board, depending on the circumstances.
Dan Troyka (Dtroyka)
Posted on Thursday, October 16, 2003 - 12:16 pm:   

Set aside the cascade issue for a moment. If you want to be able to move any enemy piece one orthogonal space, the cleanest way to do this is to have the dummy piece scan the board and, for each enemy piece detected, set the from square and place an add in all four directions. This might work even with cascade if you use the "discard cascades" option but I'm not sure. If you don't mind using Zillions 2.0, you could use "create" to slide pieces instead of cascade.
Charles Kayser (Whosasking)
Posted on Thursday, October 16, 2003 - 5:31 pm:   

I work best by example. Do you mind pointing me to a code snippet or a game script that employs the technique? I could study it and determine how to incorporate it.
Charles Kayser (Whosasking)
Posted on Thursday, October 16, 2003 - 9:51 pm:   

Thank you for your help. I have developed a potential solution.

After having problems with the traversal method employed by "Neutral King Chess", I employed "shadow boards" filled with shadow pieces. This approach appears to work, but I am still in search of a potentially more efficient solution, currently without success. Does anyone have any better ideas?
Dan Troyka (Dtroyka)
Posted on Saturday, October 18, 2003 - 7:54 am:   

Here's some code I modified from an unpublished script that provides an example of using a dummy piece to move enemy pieces. It uses images from Tic Tac Toe and should be saved as a stand-alone ZRF. The code allows a player to move any enemy piece one orthogonal space to an empty square in lieu of dropping a piece. The cascading is not implemented here.

(game

(title "Test: Moving an Enemy")
(players X O)
(turn-order X O)

(board
(image "images\TicTacToe\TTTbrd.bmp")
(grid
(start-rectangle 16 16 112 112)
(dimensions
("a/b/c" (112 0))
("3/2/1" (0 112)))
(directions (n 0 -1) (e 1 0) (s 0 1) (w -1 0) (next 1 0))
)
(dummy x1 x2)
(links next (c1 a2) (c2 a3))
)

(piece
(name man)
(image X "images\TicTacToe\TTTX.bmp"
O "images\TicTacToe\TTTO.bmp")
(drops ((verify empty?) add))
)

(piece
(name Puppeteer)
(moves
(a1
(while on-board?
(if enemy? from
(if (empty? n) n add s)
(if (empty? s) s add n)
(if (empty? e) e add w)
(if (empty? w) w add e)
)
next)
)
)
)

(board-setup
(X (man off 5) (Puppeteer x1))
(O (man off 5) (Puppeteer x2))
)
)

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: