예제 #1
0
    def _merge(cls, *s):
        if len(s) == 1:
            return s[0]

        res = []
        for cells in zip(*s):
            res.append(from_two_powers(cells))

        return res
예제 #2
0
    def _color_id_by_name(self, color):
        color_id = self.board.color_id_by_name(color)
        if color_id:
            return color_id

        if is_list_like(color):
            return from_two_powers(
                self.board.color_id_by_name(single_color)
                for single_color in color)

        return None
예제 #3
0
 def _cell_value_from_solved(cls, states):
     # assert states.size
     return from_two_powers(states)
예제 #4
0
    def test_round_trip(self):
        for i in range(100):
            n = random.randint(1, 10**9)

            factors = two_powers(n)
            assert from_two_powers(factors) == n
예제 #5
0
 def _single_color(cls, values):
     return from_two_powers(values)