コード例 #1
0
def make_elixir_to_induce_euphoria():
    '''
    The Elixir to Induce Euphoria is a sunshine-yellow potion that induces
    a sense of inexplicable, irrational happiness upon the drinker.
    '''
    cauldron = get_cauldron()
    ingredients = get_ingredients("Elixir To Induce Euphoria")
    # add the first ingredient into the cauldron
    cauldron = add(cauldron, ingredients[0])
    # add the second ingredient into the cauldron
    cauldron = add(cauldron, ingredients[1])
    # stir four times
    cauldron = stir(cauldron, 4)
    # add the third ingredient into the cauldron
    cauldron = add(cauldron, ingredients[2])
    # add the fourth ingredient into the cauldron
    cauldron = add(cauldron, ingredients[3])
    # add the fifth ingredient into the cauldron
    cauldron = add(cauldron, ingredients[4])

    # stir six times
    cauldron = stir(cauldron, 6)

    # render the cauldron into a potion (we did this for you!)
    potion = render_potion(cauldron)
    return potion
コード例 #2
0
ファイル: potionization.py プロジェクト: Brinews/jacky
def make_elixir_to_induce_euphoria():
    '''
    The Elixir to Induce Euphoria is a sunshine-yellow potion that induces
    a sense of inexplicable, irrational happiness upon the drinker.
    '''
    cauldron = get_cauldron()
    ingredients = get_ingredients("Elixir To Induce Euphoria")
    # add the first ingredient into the cauldron

    cauldron = add(cauldron, ingredients[0])

    # add the second ingredient into the cauldron
    cauldron = add(cauldron, ingredients[1])

    # stir four times
    cauldron = stir(cauldron, 4)

    # add the third ingredient into the cauldron
    cauldron = add(cauldron, ingredients[2])

    # add the fourth ingredient into the cauldron
    cauldron = add(cauldron, ingredients[3])

    # add the fifth ingredient into the cauldron
    cauldron = add(cauldron, ingredients[4])

    # stir six times
    cauldron = stir(cauldron, 6)

    # render the cauldron into a potion (we did this for you!)
    potion = render_potion(cauldron)
    return potion
コード例 #3
0
ファイル: potionization.py プロジェクト: shivsp/git_exercise
def make_felix_felicis():
    '''
    Felix Felicis, also called "Liquid Luck", is a magical potion that makes
    the drinker lucky for a period of time, during which everything they attempt
    will be successful.   
    '''
    cauldron = get_cauldron()
    ingredients = get_ingredients("Felix Felicis")
    # add the first ingredient into the cauldron
    cauldron = add(cauldron, ingredients[0])
    # add the second ingredient into the cauldron
    cauldron = add(cauldron, ingredients[1])
    # add the third ingredient into the cauldron
    cauldron = add(cauldron, ingredients[2])
    # stir 10 times
    cauldron = stir(cauldron, 10)
    # add the fourth ingredient into the cauldron
    cauldron = add(cauldron, ingredients[3])
    # add the fifth ingredient into the cauldron
    cauldron = add(cauldron, ingredients[4])
    # stir once
    cauldron = stir(cauldron, 1)
    # add the sixth ingredient into the cauldron
    cauldron = add(cauldron, ingredients[5])
    # stir once
    cauldron = stir(cauldron,1)
    # add the seventh ingredient into the cauldron
    cauldron = add(cauldron, ingredients[6])
    # stir 10 times
    cauldron = stir(cauldron,10)
    # say incantation
    cauldron = say_incantation(cauldron)
    # render the cauldron into a potion (we did this for you!)
    potion = render_potion(cauldron)
    return potion
コード例 #4
0
def make_felix_felicis():
    '''
    Felix Felicis, also called "Liquid Luck", is a magical potion that makes
    the drinker lucky for a period of time, during which everything they attempt
    will be successful.   
    '''
    cauldron = get_cauldron()
    ingredients = get_ingredients("Felix Felicis")
    # add the first ingredient into the cauldron
    cauldron = add(cauldron, ingredients[0])

    # add the second ingredient into the cauldron
    cauldron = add(cauldron, ingredients[1])

    # add the third ingredient into the cauldron
    cauldron = add(cauldron, ingredients[2])

    # stir 10 times
    cauldron = stir(cauldron, 10)

    # add the fourth ingredient into the cauldron
    cauldron = add(cauldron, ingredients[3])

    # add the fifth ingredient into the cauldron
    cauldron = add(cauldron, ingredients[4])

    # stir once
    cauldron = stir(cauldron, 1)

    # add the sixth ingredient into the cauldron
    cauldron = add(cauldron, ingredients[5])

    # stir once
    cauldron = stir(cauldron, 1)

    # add the seventh ingredient into the cauldron
    cauldron = add(cauldron, ingredients[6])

    # stir 10 times
    cauldron = stir(cauldron, 10)

    # say incantation
    cauldron = say_incantation(cauldron)

    # render the cauldron into a potion (we did this for you!)
    potion = render_potion(cauldron)
    return potion
コード例 #5
0
ファイル: play.py プロジェクト: bhinesley/pynthesizer
    def imperial_march(bar=-1, instrument='square'):
        dur = 28

        # set "instrument" (in this case, just an oscillator)
        o_args = {'sample_rate': sample_rate}
        if instrument is None or instrument == 'square':
            o = oscil.Square
            o_args['duty'] = 0.5
        elif instrument == 'sawtooth':
            o = oscil.Sawtooth
            o_args['width'] = 1.0
        else:
            o = oscil.Sine
        wf = bwf = functools.partial(o, **o_args)

        # set up chords
        silence = oscil.Flat(sample_rate)
        Gm = mixer.add((wf(hz=D, vol=1/4),
                        wf(hz=Bb, vol=1/4),
                        wf(hz=G, vol=1/4),
                        bwf(hz=G/2, vol=1/4)))
        Gm_low = mixer.add((wf(hz=D, vol=1/4),
                        wf(hz=Bb, vol=1/4),
                        wf(hz=G, vol=1/4),
                        bwf(hz=Eb/2, vol=1/4)))
        Eb_m = mixer.add((wf(hz=Eb, vol=1/4),
                        wf(hz=Gb, vol=1/4),
                        wf(hz=Bb, vol=1/4),
                        bwf(hz=Eb/2, vol=1/4)))
        Eb_m2 = mixer.add((wf(hz=Eb, vol=1/3),
                        wf(hz=Gb, vol=1/3),
                        wf(hz=Bb, vol=1/3)))
        Gm2 = mixer.add((wf(hz=D*2, vol=1/3),
                        wf(hz=Bb*2, vol=1/3),
                        wf(hz=G*2, vol=1/3)))

        # first two bars
        if bar == -1 or bar == 1 or bar == 2:
            for _ in range(3):
                for _, a in zip(range(dur), Gm): yield a
                for _, a in zip(range(int(dur/3)), silence): yield a
            for _ in range(2):
                for _, a in zip(range(dur), Eb_m): yield a
                for _, a in zip(range(int(dur/2)), wf(hz=D*2, vol=1/3)): yield a
                for _, a in zip(range(dur), Gm): yield a
                for _, a in zip(range(int(dur/3)), silence): yield a
            for _, a in zip(range(int(dur/3)), silence): yield a
            for _, a in zip(range(int(dur/2)), wf(hz=G/2, vol=1/3)): yield a

        if bar == -1 or bar == 3 or bar == 4:
            # 3rd bar
            for _ in range(3):
                for _, a in zip(range(dur), Gm2): yield a
                for _, a in zip(range(int(dur/3)), silence): yield a
            for _, a in zip(range(dur), Eb_m2): yield a
            #for _, a in zip(range(dur), Gm): yield a
            for _, a in zip(range(int(dur/2)), wf(hz=D*2, vol=1/3)): yield a

            # 4th bar
            for _, a in zip(range(dur), Gm_low): yield a
            for _, a in zip(range(int(dur/3)), silence): yield a
            for _, a in zip(range(dur), Eb_m): yield a
            for _, a in zip(range(int(dur/2)), wf(hz=D*2, vol=1/3)): yield a
            for _, a in zip(range(dur), Gm): yield a