Skip to content
This repository has been archived by the owner on Nov 18, 2020. It is now read-only.

Commit

Permalink
Merge pull request #1 from ejmr/silver-promotion-prompt
Browse files Browse the repository at this point in the history
[Feature] Always prompt the user before promoting a silver
  • Loading branch information
John Cheetham committed Mar 28, 2015
2 parents 30ad781 + 184c740 commit 268a5dc
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions gshogi/gshogi.py
Expand Up @@ -239,13 +239,17 @@ def get_move(self, piece, src, dst, src_x, src_y, dst_x, dst_y):
move = self.src + dst
# check for promotion
if self.promotion_zone(src, dst, self.stm):
promote = self.board.promote(piece, src_x, src_y, dst_x, dst_y, self.stm)
if (promote == 2):
# must promote
move = move + "+"
elif (promote == 1):
# promotion is optional
if self.ask_before_promoting:
promote = self.board.promote(piece, src_x, src_y, dst_x, dst_y, self.stm)
if (promote == 2):
# must promote
move = move + "+"
elif (promote == 1):
# promotion is optional
#
# But always prompt before promoting a silver since it
# can be valuable to have an unpromoted silver on the
# opposite side of the board.
if self.ask_before_promoting or piece == " s" or piece == " S":
response = self.gui.promote_popup()
if (response == gtk.RESPONSE_CANCEL):
return None
Expand Down

0 comments on commit 268a5dc

Please sign in to comment.