How do I drop pieces during the game Log Out | Topics | Search
Moderators | Register | Edit Profile

Zillions of Games Discussion Forum » Designing Games for Zillions » How do I drop pieces during the game « Previous Next »

Author Message
William Butler (Wgbutler)
New member
Username: Wgbutler

Post Number: 6
Registered: 5-2008
Posted on Thursday, July 09, 2009 - 11:38 pm:   

Here is what I would like to do. Each player has two pieces in reserve that are off the board, lets call them piece A and piece B.

Whenever the player moves a piece that is on the board for the first time, he can immediately drop one of his reserve pieces on the square that the just moved piece moved away from.

Once he drops one of his reserve pieces the other one will go away (he can only drop one reserve piece per game).

This is kind of like Seirawan-chess with a twist. Does anyone have any ideas how I can do the move+drop in one move? All of the examples I've seen so far either force me to choose a position for the reserve piece at the beginning of the game or only allow me to drop a reserve piece on the board as an entire move.

Any help is appreciated.

Thanks,

William Butler
M Winther (Kalroten)
New member
Username: Kalroten

Post Number: 121
Registered: 1-2007
Posted on Saturday, July 11, 2009 - 1:36 am:   

This is an interesting idea. Pieces on the initial row could be named xBishop, xKnight, etc. When an xKnight moves it turns into a Knight. But the xKnight's move-definition calls a function 1leap2 that ends with a mark (go from) (create Chancellor) back (add Knight). The move-definition also calls a function 2leap2 that ends with a mark (go from) (create Archbishop) back (add Knight). In this way Zillions will create a pop-up dialog that allows you to choose between an Archbishop or a Chancellor. In this way you needn't place the extra pieces outside the board. But you could also position graphical dummy-pieces externally and remove them by (change-type invisible-piece).
/Mats
M Winther (Kalroten)
New member
Username: Kalroten

Post Number: 122
Registered: 1-2007
Posted on Saturday, July 11, 2009 - 1:53 am:   

Of course, you must also insert a standard knight-move in the move-definition of xknight (i.e. that simply ends with (add knight)). In this way he can make a move without introducing the external pieces. In orde to prevent pieces from introducing them several times you only need to check the existence of the dummy-archbishop etc. (verify (piece? dummy-archbishop x1))
/Mats
M Winther (Kalroten)
New member
Username: Kalroten

Post Number: 123
Registered: 1-2007
Posted on Saturday, July 11, 2009 - 1:55 am:   

Or better (verify (not-piece? invisible-piece x1))
/Mats
M Winther (Kalroten)
New member
Username: Kalroten

Post Number: 124
Registered: 1-2007
Posted on Saturday, July 11, 2009 - 6:32 am:   

The above was too complicated. Of course, it is not necessary to call different functions. It is better to have one function which ends with (add Knight) (add Chancellor) (add Archbishop). It is more cost effective, and Zillions would otherwise greatly overestimate the piece value of the xKnight, etc. In this case Zillions will be reluctant to move it as soon as the external piece has been introduced. As the code contains more adds, this should occur anyway. But then you can increase the value of the normal pieces by tweaking, or you can encourage development by creating an invisible reward piece outside the board (see my chess variants)
http://hem.passagen.se/melki9/chessvar.htm

Mats
William Butler (Wgbutler)
New member
Username: Wgbutler

Post Number: 7
Registered: 5-2008
Posted on Wednesday, July 15, 2009 - 12:00 am:   

Mats,

I'm having problems getting the drop logic to work with sliding pieces (like the Bishop or Rook). I've gotten it to work with the Knight. Can you paste some complete code for a sliding piece? And thanks for all of your help, its greatly appreciated. BTW, is there anywhere I can download a copy of your Seirawan chess zrf file?

Thanks,

W. Butler
M Winther (Kalroten)
New member
Username: Kalroten

Post Number: 125
Registered: 1-2007
Posted on Wednesday, July 15, 2009 - 1:29 pm:   

No, Seirawan himself asked me not to distribute the game.

For an "xbishop" the code should look something like this (without indentations) :


(define xbishop_slide ( $1
(while empty?
(add Bishop)
(if (not-piece? empty_piece x1)
(change-type empty-piece x1) (add Chancellor) (add Archbishop)
)
$1
)
(verify not-friend?)
(add Bishop)
(if (not-piece? empty_piece x1)
(change-type empty-piece x1)(add Chancellor) (add Archbishop)
)
))


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: