from manim import *
from manim import DARK_GREY, LIGHT_GREY, BLUE, PURPLE
config.background_color = WHITE

class sim(Scene):
    def construct(self):

        # Baum umgekehrt aufbauen
        line6 = Line([-4,0,0], [-1,1.5,0])
        line7 = Line([-4,0,0], [-1,-1.5,0])
        line6.set_stroke(BLACK, width=1.5)
        line7.set_stroke(BLACK, width=1.5)
        dot6 = Dot(point=[-1,1.5,0], color='BLACK')
        dot7 = Dot(point=[-1,-1.5,0], color='BLACK')
        tex6 = MathTex(r"B_1", color=BLACK).scale(1)
        tex7 = MathTex(r"B_2", color=BLACK).scale(1)
        tex6.move_to([-0.5,1.5,0])
        tex7.move_to([-0.5,-1.5,0])
        # beschriftung pfade stufe 1
        tex1a = MathTex(r"P(B_1)", color=BLACK).scale(0.6)
        tex2a = MathTex(r"P(B_2)", color=BLACK).scale(0.6)
        tex1a.move_to([-2.5,1.1,0]).rotate(PI/6)
        tex2a.move_to([-2.5,-1.1,0]).rotate(-PI/6)
        self.play(FadeIn(line6,line7,dot6,dot7,tex6,tex7,tex1a,tex2a))

        line1 = Line([0, 1.5, 0], [3,2.5,0])
        line2 = Line([0, 1.5, 0], [3,1.5,0])
        line3 = Line([0, 1.5, 0], [3,0.5,0])
        line1.set_stroke(BLACK, width=1.5)
        line2.set_stroke(BLACK, width=1.5)
        line3.set_stroke(BLACK, width=1.5)
        dot1 = Dot(point=[3,2.5,0], color='BLACK')
        dot2 = Dot(point=[3,1.5,0], color='BLACK')
        dot3 = Dot(point=[3,0.5,0], color='BLACK')

        line1b = Line([0, -1.5, 0], [3,-0.5,0])
        line2b = Line([0, -1.5, 0], [3,-1.5,0])
        line3b = Line([0, -1.5, 0], [3,-2.5,0])
        line1b.set_stroke(BLACK, width=1.5)
        line2b.set_stroke(BLACK, width=1.5)
        line3b.set_stroke(BLACK, width=1.5)
        dot1b = Dot(point=[3,-0.5,0], color='BLACK')
        dot2b = Dot(point=[3,-1.5,0], color='BLACK')
        dot3b = Dot(point=[3,-2.5,0], color='BLACK')

        # beschriftung pfade stufe 2
        tex1d = MathTex(r"?", color=BLACK).scale(0.6)
        tex2d = MathTex(r"?", color=BLACK).scale(0.6)
        tex3d = MathTex(r"?", color=BLACK).scale(0.6)
        tex1d.move_to([1.7,2.3,0])
        tex2d.move_to([1.7,1.7,0])
        tex3d.move_to([1.7,1.1,0])
        tex1e = MathTex(r"?", color=BLACK).scale(0.6)
        tex2e = MathTex(r"?", color=BLACK).scale(0.6)
        tex3e = MathTex(r"?", color=BLACK).scale(0.6)
        tex1e.move_to([1.7,-0.7,0])
        tex2e.move_to([1.7,-1.3,0])
        tex3e.move_to([1.7,-1.85,0])

        # Ergebnisse
        tex1b = MathTex(r"A_1", color=BLACK).scale(1)
        tex2b = MathTex(r"A_2", color=BLACK).scale(1)
        tex3b = MathTex(r"A_3", color=BLACK).scale(1)
        tex1b.move_to([3.5,2.5,0])
        tex2b.move_to([3.5,1.5,0])
        tex3b.move_to([3.5,0.5,0])
        tex1c = MathTex(r"A_1", color=BLACK).scale(1)
        tex2c = MathTex(r"A_2", color=BLACK).scale(1)
        tex3c = MathTex(r"A_3", color=BLACK).scale(1)
        tex1c.move_to([3.5,-0.5,0])
        tex2c.move_to([3.5,-1.5,0])
        tex3c.move_to([3.5,-2.5,0])

        self.play(FadeIn(line1,line2,line3,line1b,line2b,line3b,dot1,dot2,dot3,dot1b,dot2b,dot3b,tex1b,tex2b,tex3b,tex1c,tex2c,tex3c,tex1d,tex2d,tex3d,tex1e,tex2e,tex3e))


        self.wait(5)
