Make a scalable Christmas Tree

  • Your challenge: Make a Christmas tree. The size must be choosable by some input method, but doesn't have to be directly related to any part of the tree; however, larger inputs should produce a larger tree.



    How can you make it? You can make the tree any way you like, other than by printing the unicode character for the tree, such as ouputting an image, ascii art, with other aspects, etc. Whatever you do, remember that this is a , so be creative.



    The answer with the most upvotes by the end of December wins, but I'll accept another if it gets higher


    Nice question ;)

    A pity decorations weren't mandatory!

    @Lohoris I think it is good that they aren't mandatory. This way, people can do what they want, and those brilliant fractal trees are legitimate answers.

    @Quincunx you could add decorations even to fractal trees...

    @Lohoris yes, but they are plenty as is. The author of those trees could add decorations if they'd like to, but I'd rather not require it.

    @dystroy: it sais printing out the unicode tree is a no-go. Anything else (including ascii art) is fine.

    @SztupY I've reread and you're right. Then it seems you're allowed to fetch an image with wget :\

    @Quincunx, Is ASCII art allowed?

    @Pacerier Yes, of course, as stated in the question.

    Almost makes me want to take input as if it was a p-adic number just to make it confusing as to what "larger input should produce larger output" actually means.

  • Python



    A fractal Christmas tree using the turtle package:



    enter image description here



    n = input()*1.

    from turtle import *
    speed("fastest")
    left(90)
    forward(3*n)
    color("orange", "yellow")
    begin_fill()
    left(126)
    for i in range(5):
    forward(n/5)
    right(144)
    forward(n/5)
    left(72)
    end_fill()
    right(126)

    color("dark green")
    backward(n*4.8)
    def tree(d, s):
    if d <= 0: return
    forward(s)
    tree(d-1, s*.8)
    right(120)
    tree(d-3, s*.5)
    right(120)
    tree(d-3, s*.5)
    right(120)
    backward(s)
    tree(15, n)
    backward(n/2)

    import time
    time.sleep(60)


    n is the size parameter, the shown tree is for n=50. Takes a minute or two to draw.


    This looks lovely `:)`

License under CC-BY-SA with attribution


Content dated before 7/24/2021 11:53 AM