Print a Christmas Tree

I know this doesn't comply with the spec, but I thought I'd try to add some diversity to the trees here by imitating this classic ASCII art Christmas scene by Joan G. Stark.

I didn't try to reproduce the whole picture — that would've been a bit too much — but just the tree, for which I present this 138-byte Perl program:

$_=join$/,qw'11| 8\2_2/ 9(\o/) 5---2/1\2--- 10>*<',map(11-$_.A.AA x$_,2..11),'9\|H|/';s/\d+/$"x$&/eg,s/A/substr">>>@*O<<<",rand 9,1/eg,say

And, of course, here's a sample of the output:

           |
        \  _  /
         (\o/)
     ---  / \  ---
          >*<
         >O><@
        <><<>><
       @><><>@<<
      @<O><*@*>>O
     OO@@*O<<<*<OO
    ><<>@><<>@<><><
   >><O<>>><@*>>><<O
  *<>*<><<>@><O*>><*<
 O><><<@<*>><O*@>O><>*
O<><<><@O>>*O*OO<><<>O>
         \|H|/

Try it online!

The code uses the Perl 5.10+ say feature, and so needs to be run with the -M5.010 (or -E) command line switch. (Actually, just replacing the say at the end with print would avoid that, at the cost of two more bytes and the loss of the newline after the last line of output.)

Note that the bulk of the tree is randomly generated, so the placement of the ornaments will vary between runs. The angel, the stand and the top row of the tree are fixed, though.


To keep this popular answer from being summarily deleted under a policy instituted after it was posted, here's a token spec-compliant solution as well (45 bytes, also Perl 5):

$_=$"x10 ."*";say,s/ 0/00/,s/\*?$/0/ while/ /

Try it online!

Like the program above, this one also needs to be run on Perl 5.10+ with the -M5.010 switch to enable the say feature. Obviously (this being a kolmogorov-complexity challenge) it produces the exact same boring output as all the other compliant entries, which I won't bother repeating here. (It's also trivially resizable by changing the number 10 to any other other value.)


Golfscript, 27 characters

" "9*"*"9,{n\.4$>\.+)"0"*}%

The resulting tree looks like this:

         *
         0
        000
       00000
      0000000
     000000000
    00000000000
   0000000000000
  000000000000000
 00000000000000000

A version which uses the height parameter only once is one character longer:

9." "*"*"@,{n\.4$>\.+)"0"*}%

Reading the height from stdin (with input "10" to generate the example tree) takes the same amount of characters (28):

~,)" "*"*"@{n\.4$>\.+)"0"*}%

GolfScript (33 chars)

Fixed-height version:

;8:^' '*.'*'+\'0'+^{.(;'00'+}*]n*

Or for exactly the same length

;8:^' '*.'*'+n@'0'+^{.n\(;'00'+}*

The tree looks remarkably similar to everyone else's:

        *
        0
       000
      00000
     0000000
    000000000
   00000000000
  0000000000000
 000000000000000
00000000000000000

Version which takes height from stdin:

~((:^' '*.'*'+\'0'+^{.(;'00'+}*]n*

The start of the previous line is one of the better smilies I've made in a "useful" GolfScript program.