Skip to content
This repository was archived by the owner on Jul 8, 2023. It is now read-only.

Commit 3f81fd8

Browse files
committed
Fix a bug with wrong one line tiles presentation
1 parent 12fb102 commit 3f81fd8

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

project/mahjong/tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ class TileTestCase(unittest.TestCase):
165165
def test_convert_to_one_line_string(self):
166166
tiles = [0, 1, 34, 35, 36, 37, 70, 71, 72, 73, 106, 107, 108, 109, 133, 134]
167167
result = TilesConverter.to_one_line_string(tiles)
168-
self.assertEqual('1199s1199p1199m1177z', result)
168+
self.assertEqual('1199m1199p1199s1177z', result)
169169

170170
def test_convert_to_34_array(self):
171171
tiles = [0, 34, 35, 36, 37, 70, 71, 72, 73, 106, 107, 108, 109, 134]

project/mahjong/tile.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ def to_one_line_string(tiles):
3232
honors = [t for t in tiles if t >= 108]
3333
honors = [t - 108 for t in honors]
3434

35-
man = man and ''.join([str((i // 4) + 1) for i in man]) + 'm' or ''
35+
man = man and ''.join([str((i // 4) + 1) for i in man]) + 's' or ''
3636
pin = pin and ''.join([str((i // 4) + 1) for i in pin]) + 'p' or ''
37-
sou = sou and ''.join([str((i // 4) + 1) for i in sou]) + 's' or ''
37+
sou = sou and ''.join([str((i // 4) + 1) for i in sou]) + 'm' or ''
3838
honors = honors and ''.join([str((i // 4) + 1) for i in honors]) + 'z' or ''
3939

4040
return sou + pin + man + honors

0 commit comments

Comments
 (0)