summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWolfgang Rohdewald <wolfgang@rohdewald.de>2015-11-27 10:49:08 (GMT)
committerWolfgang Rohdewald <wolfgang@rohdewald.de>2016-08-25 06:41:35 (GMT)
commitb44e06807bdee9cea4b7a5a497b266bb9f604ab4 (patch)
treed2a0127adb67568456be04d2d030fbdbd73d9fdb
parentdf0fd9813019f6572c93fd3b708cb54378c0de1b (diff)
Hand.__add_ now uses newString instead of own building code
-rw-r--r--src/hand.py13
1 files changed, 2 insertions, 11 deletions
diff --git a/src/hand.py b/src/hand.py
index 894c110..2d9212e 100644
--- a/src/hand.py
+++ b/src/hand.py
@@ -446,22 +446,13 @@ class Hand(object):
# combine all parts about hidden tiles plus the new one to one part
# because something like DrDrS8S9 plus S7 will have to be reordered
# anyway
- parts = [str(self.declaredMelds)]
- parts.extend(str(x[0]) for x in self.bonusMelds)
- parts.append('R' + ''.join(str(x) for x in sorted(
- self.tilesInHand + [addTile])))
- if self.announcements:
- parts.append('m.' + ''.join(sorted(self.announcements)))
- parts.append('L' + addTile)
- ns = self.newString(chain(self.declaredMelds, self.bonusMelds),
+ ns = self.newString(melds=chain(self.declaredMelds, self.bonusMelds),
rest=self.tilesInHand + [addTile],
lastSource=None,
lastTile=addTile,
lastMeld=None
)
- result = ' '.join(parts).strip()
- assert result == ns, 'newString falsch: "{}" <> "{}", parts={}'.format(result, ns, parts)
- return Hand(self.player, result, prevHand=self)
+ return Hand(self.player, ns, prevHand=self)
def __sub__(self, subtractTile):
"""returns a copy of self minus subtractTiles.