Exemple #1
0
 def matter(cls, m: Matter, color_dict: dict) -> Matter:
     if m.a is not None:
         if m.a in color_dict.keys():
             new_matter = m.paste_color(color_dict[m.a])
         else:
             flag, bar = is_monotone(color_dict)
             if flag:
                 if m.a >= flag:
                     new_matter = m.paste_color(color_dict[max(color_dict.keys())])
                 else:
                     new_matter = m.paste_color(color_dict[min(color_dict.keys())])
             else:
                 raise AssertionError
         return new_matter
     else:
         return m
 def matter(cls, m: Matter, op: str, const: int, color_add: int) -> Matter:
     assert m.a is not None
     if op == "<=":
         if m.a <= const:
             return m.paste_color(color_add)
         else:
             return m
     elif op == "==":
         if m.a == const:
             return m.paste_color(color_add)
         else:
             return m
     elif op == ">=":
         if m.a >= const:
             return m.paste_color(color_add)
         else:
             return m
     else:
         raise NotImplementedError
Exemple #3
0
 def matter_temp(cls, m: Matter) -> Matter:
     if m.a is not None:
         new_matter = m.paste_color(m.a + 10)
         return new_matter
     else:
         return m
 def matter(cls, m: Matter, full: bool) -> Case:
     if full:
         return m.paste_color_full()
     else:
         return m.paste_color()