Пример #1
0
 def replace(self):
     x = self.dist
     return (
         S(x),
         Push(), R(80), T(10), Pop(),
         Push(), R(-80), T(10), Pop(),
         F(x)
     )
Пример #2
0
 def replace(self):
     w = int(self.width / 2)
     if 27 > self.length:
         return (self, Push(), Rot(randint(-30, 30)), Leaf(), Pop(), Push(),
                 Rot(randint(-30, 30)), Leaf(), Pop(), Push(),
                 Rot(randint(-30, 30)), Leaf(), Pop())
     return (self, Push(), Rot(-45), Branch(self.length * .54,
                                            w), Pop(), Push(), Rot(-19),
             Branch(self.length * .52,
                    w), Pop(), Push(), Rot(5), Branch(self.length * .49, w),
             Pop(), Push(), Rot(19), Branch(self.length * .51, w), Pop(),
             Push(), Rot(62), Branch(self.length * .45, w), Pop())
Пример #3
0
    def replace(self):
        left, right = self.left_context, self.right_context

        if isinstance(left[0], Zero) and isinstance(right[0], Zero):
            return (Zero(),)
        elif isinstance(left[0], Zero) and isinstance(right[0], One):
            return (One(), Push(), Rot(27.5), F(), One(), F(), One(), Pop())
        elif isinstance(left[0], One) and isinstance(right[0], Zero):
            return (Zero(),)
        elif isinstance(left[0], One) and isinstance(right[0], One):
            return (One(), F(), One())
        return (Zero(),)
Пример #4
0
 def replace(self):
     angle = 25.7
     return choices(
         ((F(), Push(), Rot(angle), F(), Pop(), F(), Push(), Rot(-angle),
           F(), Pop(), F()), (F(), Push(), Rot(angle), F(), Pop(), F()),
          (F(), Push(), Rot(-angle), F(), Pop(), F())))[0]
Пример #5
0
 def replace(self):
     return (Push(), F()) + (Rotate(15), F()) * 3 + (Push(), Rotate(
         3 * -15), Y(), Pop(), Rotate(5 * 15), F(), Rotate(
             8 * 15), F()) + (Rotate(-15), F()) * 3 + (Pop(), )
Пример #6
0
 def replace(self):
     angle = 25
     return (F(), F(), Rot(angle), Push(), Rot(angle), F(), Rot(-angle),
             F(), Rot(-angle), F(), Pop(), Rot(-angle), Push(), Rot(-angle),
             F(), Rot(angle), F(), Rot(angle), F(), Pop())