def test_is_ready(): mj_set = MjSet() concealed = [] for _ in range(4): concealed.append(mj_set.draw()) concealed.append(mj_set.draw()) concealed.append(mj_set.draw()) mj_set.draw() concealed.append(mj_set.draw()) print(Rule.convert_tiles_to_str(concealed)) print(Rule.is_ready(concealed))
def test_convert(): mj_set = MjSet() mj_set.shuffle() concealed = [] for _ in range(13): concealed.append(mj_set.draw()) print(Rule.convert_tiles_to_str(concealed)) arr = Rule.convert_tiles_to_arr(concealed) print(arr) tiles = Rule.convert_arr_to_tiles(arr) print(Rule.convert_tiles_to_str(tiles))
def draw(self, mj_set: MjSet): tile = mj_set.draw() if not tile: print("mj_set.draw() None") return None if not Rule.is_flower(tile): self.add(tile) self._draw_count += 1 return tile print(self, 'get a flower:', tile) self.flowers.append(tile) tile = self.draw_from_back(mj_set) print("draw_from_back:", tile) return tile