I had trouble implementing aka dora. I had to change utils class to this:
@staticmethod
def string_to_136_array(sou=None, pin=None, man=None, honors=None):
"""
Method to convert one line string tiles format to the 136 array
We need it to increase readability of our tests
"""
def _split_string(string, offset, red=None):
data = []
temp = []
if not string:
return []
for i in string:
if i == 'r':
temp.append(red)
data.append(red)
else:
tile = offset + (int(i) - 1) * 4
if tile == red:
# prevent non reds to become red?
tile += 1
if tile in data:
count_of_tiles = len([x for x in temp if x == tile])
new_tile = tile + count_of_tiles
data.append(new_tile)
temp.append(tile)
else:
data.append(tile)
temp.append(tile)
return data
results = _split_string(man, 0, FIVE_RED_MAN)
results += _split_string(pin, 36, FIVE_RED_PIN)
results += _split_string(sou, 72, FIVE_RED_SOU)
results += _split_string(honors, 108)
return results
to pass red dora information in the tile converter. Is there a better way than this?
Nope, there is no other way to pass information about aka dora to the tile formatter right now. But it will be good to have your fixes in the main repository :)
I had trouble implementing aka dora. I had to change utils class to this:
to pass red dora information in the tile converter. Is there a better way than this?