Promote Piece upon Checkmate of King Log Out | Topics | Search
Moderators | Register | Edit Profile

Zillions of Games Discussion Forum » Designing Games for Zillions » Promote Piece upon Checkmate of King « Previous Next »

Author Message
John Turana (Tsukareta)
New member
Username: Tsukareta

Post Number: 1
Registered: 6-2020
Posted on Friday, June 19, 2020 - 12:35 am:   

Hello!
I'm trying to wrap my head around how I'd execute the following:
1. There is a piece on the board called a Prince.
2. If the King is checkmated and there is a Prince on the board, the Prince is promoted to a King and the King disappears.
3. If there is no prince and the King is checkmated, the game is over.

I cannot for the life of me figure out if it is even possible to make an "on checkmate" command to promote a piece. Is this outside the capabilities of ZoG? If so, how would I go about it in a similar fashion?
Shigeki Watanabe (Watanabe)
New member
Username: Watanabe

Post Number: 28
Registered: 3-2018
Posted on Wednesday, July 01, 2020 - 1:35 am:   

I suggest that you make each players have a additional move-turn after moving a piece due to check if the own King is attacked or not.
Shigeki Watanabe (Watanabe)
New member
Username: Watanabe

Post Number: 29
Registered: 3-2018
Posted on Wednesday, July 01, 2020 - 1:52 am:   

1:
(turn-order (White move) (NPC White check) (Black move) (NPC Black check) )

2:
(piece
(name King)
(moves
(move-type move)
(king-shift n)
....
(move-type check)
(king-check)
)
)

3:
(define king-check
( (if attacked?
(check-Prince)
else
add
)
)
)

4:
(define check-Prince
( a1
(while (on-board n)
(while (on-board e)
(if (and friend? (piece? Prince) ) (change-type King) add)
e
)
n
)
)
)
Shigeki Watanabe (Watanabe)
New member
Username: Watanabe

Post Number: 30
Registered: 3-2018
Posted on Wednesday, July 01, 2020 - 1:56 am:   

3:
(define king-check
( mark
(if attacked?
(check-Prince)
back
capture
add
else
add
)
)
)
Andreas Speiger (Andique)
New member
Username: Andique

Post Number: 25
Registered: 11-2007
Posted on Wednesday, July 08, 2020 - 5:41 am:   

@ John:
Does the code work Shigeki wrote?
Shigeki Watanabe (Watanabe)
New member
Username: Watanabe

Post Number: 31
Registered: 3-2018
Posted on Wednesday, July 15, 2020 - 1:02 am:   

That is not enough.
It doesn't work unless devised more.
I thought to implement similar processing for the royal pieces (king-pieces) such both Gyokusho (King) and Taishi (Prince) in the ZRF of the ancient Shogi.
M Winther (Kalroten)
New member
Username: Kalroten

Post Number: 179
Registered: 1-2007
Posted on Friday, October 30, 2020 - 7:31 am:   

It is easier to do if the prince is promoted when the king is captured. After all, checkmate is really capture in next move, so it is really the same thing.
Andreas Speiger (Andique)
New member
Username: Andique

Post Number: 26
Registered: 11-2007
Posted on Saturday, February 06, 2021 - 9:37 am:   

Nearly.
If king is captured, there exist no stalemate.
But i think, it is the "real" chess. This was the original rule in very old times, when chess was invented.
I prefer this old rule.
I have two kings with different loss-conditions:
(loss-condition (White Black) (checkmated King1) )
(loss-condition (White Black) (captured King2) )
So i can choose at the beginning of the game.

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: