| Author |
Message |
epicurus (Epicurus)
New member Username: Epicurus
Post Number: 3 Registered: 11-2012
| | Posted on Tuesday, November 06, 2012 - 6:23 am: | |
In my chess variant "Kingdrops" (https://chessvariants.org/~chessvar//index/listcomments.php?subjectid=d4560c339f674cfe) when a piece is captured goes to the opponent's prison. "At the end of the turn, if a player has in his prison a type of piece already present in the opponent's prison (rook and rook; bishop and bishop; guard and guard; or queen and queen), the prisoners' exchange is mandatory: the white piece in the black prison is moved to the white reserve, the black piece in the white prison is moved to the black reserve." This is an automatic mechanism (that is without interaction of the players). I don't know how to implement this process. Can someone help me, please? |
Greg Schmidt (Gschmidt2)
New member Username: Gschmidt2
Post Number: 150 Registered: 1-2007
| | Posted on Tuesday, November 06, 2012 - 9:35 am: | |
Hi Epicurus, What you describe is a bit like a castling move. I think you should look at "cascade" which allows you to chain together moves involving multiple pieces. |
epicurus (Epicurus)
New member Username: Epicurus
Post Number: 4 Registered: 11-2012
| | Posted on Tuesday, November 06, 2012 - 10:55 am: | |
Hi Greg, glad to meet you again (I'm the designer of Ecalper ). Thanks for the advise, but the big trouble for me is looping in both prisons in search of possible exchanges. |
Malcolm James Webb (Mjw)
New member Username: Mjw
Post Number: 5 Registered: 5-2008
| | Posted on Saturday, November 24, 2012 - 9:22 am: | |
You will only be exchanging pieces which you have actually captured during your turn. So the solution is to make the exchange immediately on capture rather than at the end of the turn. This is slghtly more complicated in your three moves per turn game. If we have White Rook takes Bishop on first move in the turn, then when the Rook lands we will execute a macro called (say) "bishop-add": - (verify enemy?) - (if (piece? Bishop) (bishop-add)) - (if (piece? Queen) (queen-add)) etc: - first comand of "bishop-add" is to execute "cascade": White Rook stops at capture square, Black Bishop is being moved; - Black Bishop goes to the first square in Black prison (not White): say "bp1" - Black Bishop is moved stepwise through each square in Black prison till it finds a White Bishop: - (while (or not-friend? (not-piece? Bishop)) next) - if no White Bishop is encountered, it goes from the last square in Black Prison (bp9) to the first square in WHITE prison, and again keeps going till it finds an empty square where it stops: - wp1 (while not-empty? next) add - if Black Bishop encounters White Bishop in the black prison we again execute cascade, leaving Balck Bishop in Black prison, and now moving the White Bishop we have liberated from prison: - (if (and friend? (piece? Bishop)) cascade - White Bishop is moved to a holding-cell (this is to stop it being dropped on 2nd or 3rd moves of the turn) then move is added - at end of turn the random-player moves White Bishop from holding cell to White Prison so that it is available to be dropped on next turn This avoids the necessity of searching both prisons to find the matching pair of captured pieces. |
epicurus (Epicurus)
New member Username: Epicurus
Post Number: 7 Registered: 11-2012
| | Posted on Friday, November 30, 2012 - 8:07 am: | |
Hi Malcom, thanks for your reply. Unlucky I cannot use your simple solution because my game would be changed too much (with your solution my game would be too much aggressive and not balanced, moreover it would not be possible to play it with a chess set.) For now, I'm using the implementation of "Hostage Chess" (http://www.chessvariants.org/programs.dir/zillions/hostage.zip), but I hope to solve my problem. This problem is my last one, before I can realise my final version of "Kingdrops". |
|