summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWolfgang Rohdewald <wolfgang@rohdewald.de>2015-11-23 12:09:53 (GMT)
committerWolfgang Rohdewald <wolfgang@rohdewald.de>2016-08-24 11:47:06 (GMT)
commitebccfaed28914abb7c2a86b2838e0e3aeed1c28b (patch)
treea4fa3c3a7d0a5185ad8104f401b85a9d1ca357ac
parent9d85bd21bceff05f9c9e93df96d51e59f4a55807 (diff)
Debug.mahJongg: more output
-rw-r--r--src/hand.py5
-rw-r--r--src/player.py8
2 files changed, 12 insertions, 1 deletions
diff --git a/src/hand.py b/src/hand.py
index ba8e8fb..51d2370 100644
--- a/src/hand.py
+++ b/src/hand.py
@@ -568,7 +568,10 @@ class Hand(object):
matchingMJRules = [
x for x in matchingMJRules
if 'mayrobhiddenkong' in x.options]
- return sorted(matchingMJRules, key=lambda x: -x.score.total())
+ result = sorted(matchingMJRules, key=lambda x: -x.score.total())
+ if Debug.mahJongg:
+ self.debug(u'Hand {}: found matching MJRules:{}'.format(self,matchingMJRules))
+ return result
def __arrangements(self):
"""find all legal arrangements"""
diff --git a/src/player.py b/src/player.py
index 5689c6f..7e56665 100644
--- a/src/player.py
+++ b/src/player.py
@@ -477,6 +477,10 @@ class PlayingPlayer(Player):
def declaredMahJongg(self, concealed, withDiscard, lastTile, lastMeld):
"""player declared mah jongg. Determine last meld, show concealed tiles grouped to melds"""
+ if Debug.mahJongg:
+ self.game.debug('{} declared MJ: concealed={}, withDiscard={}, lastTile={},lastMeld={}'.format(
+ self, concealed, withDiscard, lastTile, lastMeld))
+ self.game.debug(' with hand being {}'.format(self.hand))
melds = concealed[:]
self.game.winner = self
if withDiscard:
@@ -499,6 +503,9 @@ class PlayingPlayer(Player):
self._concealedMelds = melds
self._concealedTiles = []
self._hand = None
+ if Debug.mahJongg:
+ self.game.debug(' hand becomes {}'.format(self.hand))
+ self._hand = None
def __possibleChows(self):
"""returns a unique list of lists with possible claimable chow combinations"""
@@ -571,6 +578,7 @@ class PlayingPlayer(Player):
if Debug.mahJongg:
game.debug('%s may say MJ:%s, active=%s' % (
self, list(x for x in game.players), game.activePlayer))
+ game.debug(' with hand {}'.format(hand))
return MeldList(x for x in hand.melds if not x.isDeclared), withDiscard, hand.lastMeld
def __maySayOriginalCall(self):