text:
Output the legendary Yggdrasil
Your task is to output a representation of the legendary tree of life, Yggdrasil.
You must write a program whose output is exactly that :
                                       /\
                                      /**\
                                     /****\
                                    /******\
                                    /******\
                                   /********\
                                  /**********\
                                 /************\
                                /**************\
                                 /************\
                                /**************\
                               /****************\
                              /******************\
                             /********************\
                            /**********************\
                              /******************\
                             /********************\
                            /**********************\
                           /************************\
                          /**************************\
                         /****************************\
                        /******************************\
                           /************************\
                          /**************************\
                         /****************************\
                        /******************************\
                       /********************************\
                      /**********************************\
                     /************************************\
                    /**************************************\
                        /******************************\
                       /********************************\
                      /**********************************\
                     /************************************\
                    /**************************************\
                   /****************************************\
                  /******************************************\
                 /********************************************\
                /**********************************************\
                     /************************************\
                    /**************************************\
                   /****************************************\
                  /******************************************\
                 /********************************************\
                /**********************************************\
               /************************************************\
              /**************************************************\
             /****************************************************\
            /******************************************************\
                  /******************************************\
                 /********************************************\
                /**********************************************\
               /************************************************\
              /**************************************************\
             /****************************************************\
            /******************************************************\
           /********************************************************\
          /**********************************************************\
         /************************************************************\
        /**************************************************************\
               /************************************************\
              /**************************************************\
             /****************************************************\
            /******************************************************\
           /********************************************************\
          /**********************************************************\
         /************************************************************\
        /**************************************************************\
       /****************************************************************\
      /******************************************************************\
     /********************************************************************\
    /**********************************************************************\
            /******************************************************\
           /********************************************************\
          /**********************************************************\
         /************************************************************\
        /**************************************************************\
       /****************************************************************\
      /******************************************************************\
     /********************************************************************\
    /**********************************************************************\
   /************************************************************************\
  /**************************************************************************\
 /****************************************************************************\
/******************************************************************************\
                                   |--------|
                                   |--------|
                                   |--------|
                                   |--------|
                                   |--------|
                                   |--------|
                                   |--------|
                                   |--------|
                                   |--------|
                                   |--------|
                                   |--------|
                                   |________|

There is no trailing whitespace. The final newline may be omitted.
To make checking easier, here are the md5 sums of the expected output:

374899e56bc854d04639c43120642e37 - No newline at end.
03afb81d960b8e130fe2f9e0906f0482 - Newline at end

Standard loopholes apply.
This is code-golf, so the smallest entry in bytes win!

Related: http://codegolf.stackexchange.com/q/15860/15599 . Nax, you should work in marketing. Every household is going to want a Yggdrasil this Christmas. I see you answered the Graham's number question too. You must like pointy things. Let's have some new names for "rocket" and "ice cream cone."

Also related: http://codegolf.stackexchange.com/q/4244/194 .

@Nax: since the world tree has fruit, and angiosperms don't, and that is clearly a confiner of some description, unfortunately it looks like you took a picture of the wrong tree :P

@Nax Hmm. You are correct. The pedant (me) is hoist on his own petard. The md5sums have changed.

Err, point of order, Yggdrasil is definitely an ash tree in the eddas, not a fir. Kinda like this.

Golfscript, 84 77 76 75 72 characters
Different approach from Howard's. Click on the character count to try it.
10,{.)4*,\3*>{.39\-' '*'/'@2*'*'*'\
'}/}/12,{' '35*'|'@11<'_-'1/=8*1$n}/

Thanks to Howard for saving 3 characters!
Explanation:
This is more or less a straightforward port of my Python solution. Taking some expressive liberties (using named variables instead of keeping track of stack positions, and print is really keeping things on the stack, not printing):
10,{...}/            # for i in range(10):
   .                 #    x = i
   )4*,              #    Y = range((i+1)*4)
   \3*               #    x *= 3
   >                 #    Y = Y[x:]  # y is now range(3*i, (i+1)*4)
   {...}/            #    for j in Y:
      .39\-          #        q = 39 - j
      ' '*           #        print ' '*q  # print right number of spaces
      '/'            #        print '/'
      @2*            #        j *= 2
      '*'*           #        print '*'*j
      '\<NEWLINE>'   #        print "\\\n"
12,{...}/            # for i in range(12):
    ' '35*           #    print ' '*35
    '|'              #    print '|'
    @11<             #    i = i < 11
    '_-'1/=          #    z = "_-"[i] # pick "-" if i < 11, else pick "_"
    8*               #    print z*8
    1$               #    print '|' # (copy from earlier in the stack)
    n                #    print "\n"

You may use the same line-break trick as in my solution. Instead of '\\'n pull the newline into the string (+/- 0 characters) and now the backslash no longer needs to be escaped (-1 character).

Two more: 4*4+ is the same as )4* and '_-'[=] can be written '_-'1/= which makes the last + obsolete.

an explanation could be useful...? is this too much to ask?

@professorfish: Coming right up!

Don't you need a trailing ';' here? Otherwise there will be two trailing newlines since golfscript by default adds one.

Haml & Sass
37 + 277 = 314
Haml:
%link(rel="stylesheet" href="s")
%pre

Sass:
pre:after{$l:"";@for$k from0 to10{@for$i from0 to4+$k{@for$j from0 to40-($k*6+$i*2)/2{$l:$l+' ';}$l:$l+'/';@for$j from0 to$k*6+$i*2{$l:$l+'*';}$l:$l+"\\\a ";}}@for$i from0 to12{@for$j from0 to35{$l:$l+" ";}@if$i<11{$l:$l+"|--------|\a ";}@else{$l:$l+"|________|";}}content:$l;}

*Sass allows control directives, concatenation, and variable dereference.  All of which are useful when styling, but verbose while golfing.

gets generated into:
HTML:
<link rel="stylesheet" href="s" />

CSS:
pre:after {
  content: "                                        /\\\a                                        /**\\\a                                       /****\\\a                                      /******\\\a                                      /******\\\a                                     /********\\\a                                    /**********\\\a                                   /************\\\a                                  /**************\\\a                                   /************\\\a                                  /**************\\\a                                 /****************\\\a                                /******************\\\a                               /********************\\\a                              /**********************\\\a                                /******************\\\a                               /********************\\\a                              /**********************\\\a                             /************************\\\a
             /**************************\\\a                           /****************************\\\a                          /******************************\\\a                             /************************\\\a                            /**************************\\\a                           /****************************\\\a                          /******************************\\\a                         /********************************\\\a                        /**********************************\\\a                       /************************************\\\a                      /**************************************\\\a                          /******************************\\\a                         /********************************\\\a                        /**********************************\\\a                       /************************************\\\a                      /**************************************\\\a                     /******************************
**********\\\a                    /******************************************\\\a                   /********************************************\\\a                  /**********************************************\\\a                       /************************************\\\a                      /**************************************\\\a                     /****************************************\\\a                    /******************************************\\\a                   /********************************************\\\a                  /**********************************************\\\a                 /************************************************\\\a                /**************************************************\\\a               /****************************************************\\\a              /******************************************************\\\a                    /******************************************\\\a                   /**********************************
**********\\\a                  /**********************************************\\\a                 /************************************************\\\a                /**************************************************\\\a               /****************************************************\\\a              /******************************************************\\\a             /********************************************************\\\a            /**********************************************************\\\a           /************************************************************\\\a          /**************************************************************\\\a                 /************************************************\\\a                /**************************************************\\\a               /****************************************************\\\a              /******************************************************\\\a             /*****************************************************
***\\\a            /**********************************************************\\\a           /************************************************************\\\a          /**************************************************************\\\a         /****************************************************************\\\a        /******************************************************************\\\a       /********************************************************************\\\a      /**********************************************************************\\\a              /******************************************************\\\a             /********************************************************\\\a            /**********************************************************\\\a           /************************************************************\\\a          /**************************************************************\\\a         /****************************************************************\\\a        /*********
*********************************************************\\\a       /********************************************************************\\\a      /**********************************************************************\\\a     /************************************************************************\\\a    /**************************************************************************\\\a   /****************************************************************************\\\a  /******************************************************************************\\\a                                    |--------|\a                                    |--------|\a                                    |--------|\a                                    |--------|\a                                    |--------|\a                                    |--------|\a                                    |--------|\a                                    |--------|\a                                    |--------|\a
|--------|\a                                    |--------|\a                                    |________|"; }

the resulting page

You don't see a ton of HTML/CSS solutions on CodeGolf. Nice job.

CJam, 62 bytes
A,{I4+,{I3*J+_39\-S*'/@2*'**'\N}fJ}fI{35S*'|'-8*'|N++}C*'-/'_*

Try it online!
How it works
A,           " Push [ 0  …  9 ].                                                   ";
{            " For each I in that array:                                           ";
  I4+,       " Push [ 0  …  I + 3 ].                                               ";
  {          " For each J in that array:                                           ";
    I3*J+_   " Push K := 3 * I + J twice.                                          ";
    39\-S*   " Push a string consisting of 39 - K spaces.                          ";
    '/       " Push a slash.                                                       ";
    @2*'**   " Push a string consisting of 2 * K asterisks.                        ";
    '\N      " Push a backslash and a linefeed.                                    ";
  }fJ        "                                                                     ";
}fI          "                                                                     ";
{            " Do the following 12 times:                                          ";
  35S*       " Push a string consisting of 35 spaces.                              ";
  '|         " Push a vertical bar.                                                ";
  '-8*'|++   " Push the string '--------|\n'.                                      ";
}C*          "                                                                     ";
'-/'_*       " Replace the hyphen-minus signs of the last string with underscores. ";

I've got to start using CJam instead of GolfScript...

What makes CJam code so compact? Is it just usual features match together well or there is some super-trick? Or it's actually not CJam, but CJam programmers so?

@Vi.: It's a mix of both. 1. CJam is stack based, so you usually get away without using any variables. 2. All built-ins' names are at most two characters long. Because of this, you don't need whitespace except for some special cases. 3. Even submissions in golfing languages don't golf themselves. My GolfScript/CJam programs are a lot shorter now than they used to be.

Suggestion for CJam would be to use ASCII codes 128-256 for a whole nother set of built-ins. have some special editor that

@Claudiu: Well, that's up to its creator. If I designed my own golfing language, I think I would make it bit-based or encode all instructions arithmetically.

Your Try it online. link only links to the blank interpreter without your source code.

@JonathanFrech Yes, that was before the interpreter had permalinks. Fixed.

GolfScript, 79 characters
10,{:^4+,{2*^6*+'*'*.,2/~40+' '*'/'@'\
'}/}/[' '35*]12*'|--------|
'*'||''_'8**

Try the code here. Note that the line breaks aren't optional in this code

A multi-line GolfScript solution? I didn't think I'd see the day!

Python, 148 129 126 121 characters
R=range
for i in R(10):
 for j in R(i*3,4+i*4):print' '*(39-j)+'/'+'**'*j+'\\'
for c in'-'*11+'_':print' '*35+'|'+c*8+'|'

Thanks to Falko for saving 3 characters and to flornquake for brilliantly saving another 5!

Python's character multiplication is a bit too perfect for this challenge...

Wait 'till you see my golfscript solution... =P

Use '**'*j to save 3 characters. Apart from this my solution converges to the exact same code. :)

You can make the last line shorter by writing for c in'-'*11+'_':print' '*35+'|'+c*8+'|'.

@flornquake: nice! very clever

Bash, 236 197 193
10 bytes of code + 1-byte filename + 182-byte data file = 193 bytes total
zcat y 2>j

Explanation
y is a file containing the Yggdrasil, without a trailing new line, compressed with the zopfli algorithm (invoked as zopfli --i64) and then with the last 8 bytes removed. zopfli is compatible with gzip, so I can decompress the file with standard Bash utilities designed for gzip. The size of the data file is 182 bytes (229 bytes when normal gzip is used). The size of the original Yggdrasil, without the trailing new line, is 5876 bytes.
The removal of the last 8 bytes causes error messages, which are suppressed by sending standard error to a file called j. If j exists, it will be overwritten.
The base64 of y is (use base64 -d to obtain the original file):
H4sIAAAAAAACA+3SMQoCURDA0N5TWC+IFxK8yD/8Nul9hfDRnamT6J+du83zdUPwOACNNDb0+3Bs
tMPhSscDvusHgM9wIcUNclL+5r/luJXkmlh5rM3r8txkMdVNcEn1Nc2a1AU72XWz3Xd91r5z7eZD
AQKQgAI0PDFf8xJfExpQgQhkpAIdz8ytzK3AQMg6UMIQpLQELU/NQc5B/thBegtqHpOc16jHOX/v
x1mPZg19MfrdrBM=

And the md5sum is:
4a049a80241160cdde0a3cbca323b7f2

My finger was itching to hit the "delete" button when I saw the code, until I read the character count and explanation. :P

You can save about 30 bytes by using zopfli to make the compressed file.  "zopfli --i100 y" yields a 190-byte file that zcat can decompress.

And a few more if you delete the last 10 bytes and close STDERR.

@GlennRanders-Pehrson thanks for pointing this out, I've also edited my answer to 'Molar masses of compounds' http://codegolf.stackexchange.com/a/35613/16402 to use zopfli, saving 37 bytes

@Dennis it turned out to be 8 bytes (any more and bits of the Yggdrasil's trunk would be missing), thanks

For me this is a totally fresh idea - yay!  Much more interesting than the "standard" GolfScript solutions, clever though they are.

Ruby - 100
puts (0..21).map{|i|i>9??\ *35+?|+(i>20??_:?-)*8+?|:(0..i+3).map{|y|?\ *(39-z=y+3*i)+?/+?**z*2+?\\}}

Puts auto-flattens, so we can collect all the lines even in nested arrays. Needs Ruby 1.9
Try at ideone

I think it needs some leading spaces. Also, works with Ruby 1.9, but not in 1.8.

C, 169
i;j;p(a,b){while(b--)putchar(a);}main(){for(;i++<10;)for(j=i*3-4;++j<i*4;p(32,39-j),p(47,1),p(42,j*2),puts("\\"));for(++i;i--;p(32,35),p(124,1),p(i?45:95,8),puts("|"));}

Ungolfed (and slightly disentangled):
int i;
int j;
void p(a,b) {
  while (b--) putchar(a);
}
void main() {
  for (;i++<10;) {
    for (j=i*3-4;++j<i*4;) {
      p(32,39-j);
      p(47,1);
      p(42,j*2);
      puts("\\");
    }
  }
  for (++i;i--;) {
    p(32,35);
    p(124,1);
    p(i?45:95,8);
    puts("|");
  }
}

PowerShell 104 101
0..9|%{(3*$_)..(3+$_*4)|%{" "*(39-$_)+"/"+"*"*2*$_+"\"}};0..11|%{" "*35+"|"+("-","_")[$_-eq11]*8+"|"}

C# 258 234bytes
Thanks to some annoymous user for the suggested edits making good use of the String.PadLeft method!
using System;class G{static void Main(){Action<string>p=Console.WriteLine;int i=0,j;for(;i++<10;)for(j=i*3-3;j++0)p("|--------|".PadLeft(45));p("|________|".PadLeft(45));}}

The code is pretty simple, not much left to golf.
Formatted code:
using System;
class G
{
    static void Main()
    {
        Action<string> p = Console.WriteLine;
        int i = 0, j;
        for(; i++ < 10 ;)
            for(j = i*3 - 3; j++  0)
            p("|--------|".PadLeft(45));
        p("|________|".PadLeft(45));
    }
}

Using \r is pointless here. This is code golf.

@nyuszika7h indeed, but it's included in the formatted copy for good measure so that people using notepad can more easily see the glory of the Yggdrasil (it's not included in the score)

Oh, I see. Windows... Feel free to fix my edit then.

@nyuszika7h thanks for pointing out the Syntax Highlighting wasn't right

J, 98 88 84 75
(85 11 1#3 4$' /*\ |-| |_|')#"1~(39&-,1,+:,1:)"0(12$4),~85(-4&+#-:*>:)&i.10

Ruby - 139 129 126 123 121
Hoisted "puts" outside of array creation (suggestion from bitpwner).
puts (0..9).map{|i|(i*3...(i+1)*4).map{|j|"/#{'**'*j}\\".rjust(41+j,' ')}}+["%45s"%'|--------|']*11<<'%45s'%'|________|'

Ungolfed ("puts" unhoisted):

# print fill patterns from the intervals
# [0..3, 3..7, 6..11, 9..15, 12..19, 15..23, 18..27, 21..31, 24..35, 27..39]
# centered on columns 81-82
(0..9).each { |i|
  (i*3...(i+1)*4).each { |j|    # x...y vs x..y-1 saves a char
    puts "/#{'**'*j}\\".rjust(41+j,' ')
  }
}
# print the stump
puts ("%45s\n" % '|--------|') * 11
puts '%45s' % '|________|'

@bitpwner I think this deserves it's own answer. Go for it.

Perl, 127
for$i(0..9){for$j($i*3..3+$i*4){print" "x(39-$j),"/","*"x($j*2),"\\\n";}}for$i(0..11){print" "x35,"|",($i>10?"_":"-")x8,"|\n";}

Ungolfed:
for $i (0..9) {
  for $j ($i*3..3+$i*4) {
    print " "x(39-$j) , "/" , "*"x($j*2) , "\\\n";
  }
}
for $i (0..11) {
  print " "x35 , "|" , ($i>10?"_":"-")x8 , "|\n";
}

Replace $i with $_ and save 4 characters.

PHP 223 202 181 160 156
Edit I figured out how to alias a function with a variable and was able to chop off some more characters. That str_repeat function was really verbose
Edit 2: Thanks everyone for the suggestions!
Golfed:
<?$s=str_repeat;for($i=-1;$i++<9;)for($j=$i*3;$j<4+$i*4;)echo$s(' ',39-$j).'/'.$s('**',$j++)."\\
";for($i=12;$i--;)echo$s(' ',35),'|'.$s($i?'-':'_',8)."|
";

Readable:
    <?

$s=str_repeat;

for($i=-1;$i++<9;)
{
    for($j=$i*3;$j<4+$i*4;)
    {
        echo$s(' ',39-$j).'/'.$s('**',$j++)."\\
        ";
    }
}

for($i=12;$i--;)
{
    echo$s(' ',35),'|'.$s($i?'-':'_',8)."|
    ";
}

Output: http://brobin.me/yggdrasil.php

You can save 6 chars by removing parenthesis around (39-$j), ($j*2) and ($i==11). -2 by replacing \n with real new line characters (PHP allows it in litterals). -5 chars by replacing (both) for($i=0;$i<12;$i++) with for($i=12;$i-->0;) and $i==11 with $i==0.

After that you can also replace $s(($i==0?'_':'-'),8) with $s($i?'-':'_',8). (==> -5 chars)

-1 Character by replacing $s('*',$j*2) with $s('**',$j). I think that's the last improvement that I can find.

-2 changing ($j*2) in inner for to ($j++*2) and removing $j++ from for() arguments

@sebcap26 for($i=12;$i-->0;) can be shortened to for($i=12;$i--;) - another 2 chars.

@avall Nice ! I made a fiddle With all our modifications (I'm not sure if we should edit the answer) : http://jsfiddle.net/ckqhqxh1/

I just made the edits. Thanks everyone for your sugggestions! Chopped 19 characters off.

2 errors: swap '_':'-' to '-':'_' and write $j++ in second use of $j, not first.

-2 for changing for($i=0;$i<10;$i++) to for($i=-1;$i++<9;)

-2 for changing first characters to $s=str_repeat, and -1 for removing \n and simply pressing an enter there.

You can remove $i=0 if you use the -n flag. And a general hint: using str_pad is almost always shorter than str_repeat.

Javascript, 288 281
Chrome hides duplicated console.logs, use IE instead.
function t(w){s="";for(i=0;i++<39-w;)s+=" ";s+="/";for(i=0;i++<w*2;)s+="*";return s+"\\"}function r(l){s="";for(i=0;i++<36;)s+=" ";s+="|";for(i=0;i++<8;)s+=l;return s+"|"}w=0;c=console;for(h=0;h++<10;){for(j=0;j++<3+h;)c.log(t(w++));w-=h}for(j=0;j++<11;)c.log(r('-'));c.log(r('_'))

Ungolfed:
function t(w)
{
    s="";
    for(i=0;i++<39-w;)
        s+=" ";
    s+="/";
    for(i=0;i++<w*2;)
        s+="*";
    return s+"\\"
}
function r(l)
{
    s="";
    for(i=0;i++<36;)
        s+=" ";
    s+="|";
    for(i=0;i++<8;)
        s+=l;
    return s+"|"
}

w=0;
c=console;
for(h=0;h++<10;)
{
    for(j=0;j++<3+h;)
        c.log(t(w++));
    w-=h;
}
for(j=0;j++<11;)
    c.log(r('-'));
c.log(r('_'))

Use for(i=0;i++<39-w;) instead of for(i=0;i<39-w;++i), and so on. Also, p=console.log instead of c=console and p instead of c.log (although I only tested the latter in Node.js, it doesn't work in Firefox). This saves 12 bytes.

c=console.log didn't work in Chrome either, so I didn't use it. The for loop tricks save 7 bytes though.

I'm usually quite wary of anything encouraging me to use MSIE...

This is quite possibly the first time I've ever seen the phrase "use IE instead." O_o However, you can suppress Chrome's behavior by simply running this code in the console instead of from a webpage.

Running it in a page and in the console produces the same results for me on both Firefox and Chrome.

Delphi 429
Will try to improve later.
Golfed
uses strutils,SysUtils,Classes;const a='|----';b='|____';c:array [0..9,0..1]of int32=((0,3),(3,7),(6,11),(9,15),(12,19),(15,23),(18,27),(21,31),(24,35),(27,39));var t:TStrings;i,j:integer;begin t:=tstringlist.Create;for I:=0to 9do for J:=c[i,0]to c[i,1]do t.Add('/'+StringOfChar('*',j));for I:=0to 10do t.Add(a);t.Add(b);for I:=0to t.Count-1do t[i]:=t[i].PadLeft(40)+ReverseString(t[i]).Replace('/','\');write(T.TEXT);readln;end.

ungolfed
uses
  strutils,SysUtils,Classes;
const
  a='|----';
  b='|____';
  c:array [0..9,0..1]of int32=((0,3),(3,7),(6,11),(9,15),(12,19),(15,23),(18,27),(21,31),(24,35),(27,39));
var
  t:TStrings;
  i,j:integer;
begin
  t:=tstringlist.Create;
  for I:=0to 9do
    for J:=c[i,0]to c[i,1]do
      t.Add('/'+StringOfChar('*',j));
  for I:=0to 10do
    t.Add(a);
  t.Add(b);
  for I:=0to t.Count-1do
    t[i]:=t[i].PadLeft(40)+ReverseString(t[i]).Replace('/','\');
  write(T.TEXT);
  readln;
end.

C (219)
Thanks to everyone for the golfing tips -- managed to get it down to 219.  Don't think it'll go much lower.
w,W,s,S,i,r;main(){char T[78];memset(T,42,78);for(r=4,s=39;r<14;++r,s-=3,w+=6)for(i=0,S=s,W=w;i<r;++i,W+=2,--S)printf("%*s/%.*s\\\n",S,"",W,T);for(i=0;i<11;i++)printf("%35s|--------|\n","");printf("%35s|________|","");}

Required includes:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

If he's willing to use C89 he can omit all the includes as well. There is no case in this code where implicit declaration on call screws up.

@Nax; that gets me to 263 -- and I pulled includes out.  Thanks.

@Joshua -- 64 bit systems and memset could be problematic, but...otherwise, maybe not.  Either way, most people remove the includes, so I did, too.

It's actually 262 characters, you don't need the trailing newline.

You can use 32 instead of ' ' and 42 instead of  '*' :)

s/w2/b, s/s2/c .

Quick suggestions: global implicit ints, drop S, use int for space and asterisk for 228 bytes. w,w2,s2,i;main(){int r=4,s=39;char T[78];memset(T,42,78);for(;r<14;++r,s-=3,w+=6)for(i=0,s2=s,w2=w;i<r;++i,w2+=2,--s2)printf("%*s/%.*s\\\n",s2,"",w2,T);for(i=0;i<11;i++)printf("%35s|--------|\n","");printf("%35s|________|","");}

Thanks y'all...I'll keep these in mind for future golfs.  Somehow I just have issues writing golf'd code; I guess keeping code quasi-readable has been pounded in me too hard, lol.

JavaScript (console.log), 168 166
(Whitespace for readability only)
for(i=c=0;i<11;i++)
  for(j=0;j<4+i&!c;j++)
    l=i*13+j,
    a=Array(n=i-10?3*i+j+1:5).join("*-_"[k=(l>129)+(c=l==141)]),
    console.log(Array(41-n).join(" ")+'/||'[k]+a+a+'\\||'[k])

Haskell, 153 148
Straight-forward, no tricks, just plain golfing:
(a:b:c)%n=(39-n)&' '++a:(2*n)&b++c
n#m=[n..m]++(n+3)#(m+4)
(&)=replicate
main=putStr$unlines$map("/*\\"%)(take 85$0#3)++map("|-|"%)(11&4)++["|_|"%4]

The % operator draws a single line, its first argument being a String of length 3 containing the borders and the fill characters in that line (now assuming exactly 3 Chars, saving 5 bytes), the second, an Int, specifies half the number of fill characters.  Pattern matching, cons-ing and appending is used in combination in order to save bytes by taking care of the "glue" between Char and String.  In this second version, I also made # infinite and introduced a take 85 to make it finite again (no bytes saved, unfortunately).
The # operator creates the sequence for the n argument to % required for the tree: [0..3], [3..7], ... concatenated.
& is just an infix shorthand for replicate, which occurs three times.
The tree is put together in the last line, the newlines are added by unlines.

138 bytes

Lua - 164
a=' 'for i=0,9 do for j=i*3,3+i*4 do print(a:rep(39-j)..'/'..(('*'):rep(j*2))..'\\')end end for i=0,11 do print(a:rep(35)..'|'..((i>10 and'_'or'-'):rep(8))..'|')end

Java - 286
My first golf.
Golfed:
class M{public static void main(String[]args){int i=0,a,f=0;String s="";for(;i++<11;){for(a=i*3-4;++a10){a=4;if(++f>12)break;}s+=s.format("%"+(40-a)+"s"+(a>0?"%0"+a+"d":"")+"%3$s",f>0?"|":"/",0,f>0?"|":"\\").replace("0",f<1?"**":f>11?"__":"--")+"\n";}}System.out.println(s);}}

Ungolfed:
class M {
    public static void main(String[] args) {
        int i=0,a,f=0;
        String s = "";
        for(;i++<11;){
            for(a=i*3-4;++a10){
                    a=4;
                    if(++f>12)break;
                }
                s+=s.format("%"+(40-a)+"s"+(a>0?"%0"+a+"d":"")+"%3$s",f>0?"|":"/", 0,f>0?"|":"\\").replace("0", f<1?"**":f>11?"__":"--")+"\n";
            }
        }
        System.out.println(s);
    }
}

Test here

Mathematica 191 178
For sure not the best solution:
n=Nest;
t=Table;
""<>
    t[
        {n[#<>" "&,"",39-i],"/",n[#<>"*"&,"",2i],"\\\n"}
    ,
        {i,Flatten@t[Range[j+4]-1+3j,{j,0,9}]}
    ]
<>
    t[
        n[#<>" "&,"",35]<>If[i==12,"|________|\n","|--------|\n"]
    ,
        {i,12}
    ]

Not counting newlines.
Mathematica skews the output, as it doesn't take the same width for a whitespace as for "*" and "/". But the result is correct.

(it's my first golf)

Python 2, 117
j=0
while j<40:j-=j/4;exec(j/3+4)*r"print' '*(39-j)+'/'+'**'*j+'\\';j+=1;"
for c in'-'*11+'_':print' '*35+'|'+c*8+'|'

Other versions I tried include:
# 118
for i in range(10):j=i*3;exec(i+4)*r"print' '*(39-j)+'/'+'**'*j+'\\';j+=1;"
for c in'-'*11+'_':print' '*35+'|'+c*8+'|'

# 118
i=j=4
while j:j=52-3*i;exec"j-=1;print' '*j+'/'+'**'*(39-j)+'\\\\';"*i;i+=1
for c in'-'*11+'_':print' '*35+'|'+c*8+'|'

# 118
j=0
for b in'\\'*10:j-=j/4;exec(j/3+4)*"print' '*(39-j)+'/'+'**'*j+b;j+=1;"
for c in'-'*11+'_':print' '*35+'|'+c*8+'|'

# 119
s=40
while s:s+=10-s/4;exec(52-s)/3*r"s-=1;print' '*s+'/'+'**'*(39-s)+'\\';"
for c in'-'*11+'_':print' '*35+'|'+c*8+'|'

Pyth, 101 100 99 90 81 66 bytes
jbm+*;-39d++\/*\**2d\\s.e+L*3kb+L4TV11+J*35ds_B"|----";+Js_B"|____

Try it online!

Python 3.8 translation:
from functools import reduce
from operator import add
B = lambda G, H: (H, G(H))
r = lambda s: s[::-1]

print("\n".join(map(lambda d: " "*(39-d)+"/"+"*"*(2*d)+"\\", reduce(add,
map(lambda e: list(map(lambda d: 3*e[0]+d, range(e[1]))), enumerate(map(lambda d: 4+d, range(10))))))))
for N in range(11):
    print((J:=" "*35)+reduce(add, B(r, "|----")))
print(J+reduce(add, B(r, "|____")))

Isn't the a function defined in your Python equivalent to + on lists?

@EsolangingFruit It's close, but not exactly: <list>+<str> is not a valid operation, but I could just as easily use ["-"]*11+["_"]. I decided to define my own function to more accurately translate what Pyth is actually doing.

Okay, that makes sense.

Powershell, 88 bytes
0..9|%{(3*$_)..(3+$_*4)|%{' '*(39-$_)+"/$('**'*$_)\"}}
,'-'*10+'_'|%{' '*35+"|$($_*8)|"}

Groovy 118
10.times{(it*3).upto 3+it*4,{println' '*(39-it)+'/'+'*'*it*2+'\\'}};12.times{println' '*35+'|'+(it>10?'_':'-')*8+'|'}

Why am I not surprised to see a pretty short Groovy solution. My impression of Groovy was that it was done by a Java programmer who hated typing.

Racket 223 220 211 204 198
Golfed:
(for-each display(flatten(let([m make-list])`(,(for*/list([i 10][j(range(* i 3)(* 4(+ 1 i)))])`(,(m(- 39 j)" ")"/",(m j"**")"\\\n")),(for/list([c`(,@(m 11"-")"_")])`(,(m 35" ")"|",(m 8 c)"|\n"))))))

Ungolfed:
(for-each display
     (flatten
      (let([m make-list])
        `(,(for*/list([i 10][j(range(* i 3)(* 4(+ 1 i)))])
             `(,(m(- 39 j)" ")"/",(m j"**")"\\\n"))
          ,(for/list([c`(,@(m 11"-")"_")])
             `(,(m 35" ")"|",(m 8 c)"|\n"))))))

C,194
This code is a hot mess and can definitely be golfed more. Still, it was an opportunity to try out a couple of things I've never done before: using a literal for a string of asterisks, and using the width specifier * with a string in printf.
i,j=5,k=5,n;
main(){
  char d[]={[0 ...77]=42,0};
  for(;i<85;i++)k--,j+=!k,k+=(j-1)*!k,n=39-i+(j-5)*(j-4)/2,printf("%*s/%s\\\n",n,"",d+n*2);
  for(;i<97;i++)printf("%*s|\n",44,i-96?"|--------":"|________");
}

Assembly (MIPS, SPIM), 768 671 659 655 654 bytes
.text
.globl main
main:
li $8 32
li $9 47
li $t2 42
li $t3 92
li $t4 10
li $t5 42
addi $sp -4
move $4 $sp
la $s6 q
la $s5 w
li $t8 0
li $s0 10
li $t9 0
li $s3 40
li $s2 39
q:
sub $s3 $s3 $t8
add $s2 $s2 $t8
addi $t7 $t8 3
addi $t8 1
blt $s0 $t8 e
r:
sw $0 ($4)
blt $t9 $s2 t
beq $t9 $s2 y
beq $t9 $s3 u
beqz $t7 i
sb $t2 ($4)
p:
li $2 4
syscall
addi $t9 1
ble $t9 $s3 r
move $t9 $0
j $s5
o:
addi $t7 -1
bgez $t7 r
jr $s6
w:
addi $s2 -1
addi $s3 1
j o
t:
sb $8 ($4)
j p
y:
sb $9 ($4)
j p
u:
sb $t4 1($4)
sb $t3 ($4)
j p
i:
sb $t5 ($4)
j p
e:
li $t1 124
li $t3 124
li $t2 45
li $t5 95
li $t7 11
la $s6 a
la $s5 o
li $s2 35
li $s3 44
j r
a:
li $2 10
syscall

Try it online!
Edit: Saved ~100 bytes by hard coding each character in a register and simply writing to the stack, then abusing the fact that MIPS doesn't have types so implicit word to ascii string is allowed.
Edit 2: removed duplicate stack alloc. (addi $sp -4) Oops!
Edit 3: in rewrite, accidently made the tree stump 1 character too short. (36 in stead of 35). Fixed.
Edit 4: -4 bytes by using $8 and $9 instead of $t0 and $t1. they mean the same thing, but $t0 is easier to read. unfortunately, all other t registers are the same length when written nicely ($t2 == $10, but both are 3 characters), so the rest are a wash. I could (in theory) use the remaining 'a' registers (5-7. print syscall uses 4), but afaik the behavior isn't defined when using syscall.
-1 Byte by setting t8 to 0 and branching on less than instead of on equal. also required me to reorder the add ops, which unfortunately made the execution time take a whopping 3 opcodes longer.
Not the best at MIPS, but after clearing my conscience of this in meta discussion, i'm submitting them.  MIPS is not designed for this (no output, no for loops) but it's pretty fun to do this perhaps in spite of that.
Unfortunately, I haven't created a commented version for this new solution, but you can view the old version, with full documentation here
Feel free to take the credit and improve upon this answer if you can beat it - I'm probably missing a few optimizations here and there.

since this solution doesn't require .data, it's possible to convert to binary (compiled) and save a bunch of bytes. however, SPIM doesn't support it, so c'est la vie.

Also, I'm not sure if the shorthand addi $sp -4 which is really addi $sp $sp -4 is from SPIM or MIPS in general, so if anyone else does, please let me know.

Canvas, 40 bytes
Ａ｛３＋｛╷¹╷３×＋*×/×｝］⁵-＊_∔｛４×|×］∔｛║Ｌ»‾◂∔ ××］

Try it here!

Zsh, 114 bytes
0 5()<<<${(l:4$0:)1}$2
eval '(repeat '{4..13}' 0 /$S $S\\&&S+=*;);S+=***;' \;{a..l}';5 "|${(l:8::-:)}|"' '|tr - _'

Try it online!
Explanation:

0 5(): define a function under both the names 0 and 5

<<<: print
${1}: the first argument,
(l:4$0:): left-padded with spaces to the length:

$0: the name of the function
4: with a 4 prepended
so if this function is called by the name 0, it will use length 40; if 5, then 45

$2: with the second argument appended

evaluate the following string as zsh code (you can replace the eval with echo to see the generated code string is):

{4..13}: repeat the string (repeat X 0 /$S $S\\&&S+=*;);S+=***; multiple times with the numbers from 4 to 13 each in place of the X. The meaning of the string

repeat N: do this N times:

0: call the function with first argument {a / plus the variable $S} and second argument {the variable $S plus a backslash \\}
&&: then
S+=*;: append a * to the variable $S

): reset all variables (importantly $S) to their values before the (
S+=***;: append *** to $S

{a..l}: repeat the string ;X;5 "|${(l:8::-:)}|" : repeat this string with the letters from a to l each in place of the X

each letter is just a nonexistent command which is ignored; the {a..l} here just makes the code execute 12 times
5: call the function with the first argument |${(l:8::-:)}| (and no second argument)

${(l:8::-:)}: left-pad {nothing} to length 8 with dashes -
"||": surrounded by pipes

|tr - _: replace the dashes with underscores. This only applies to the last call to 5, so only the last line of the trunk is drawn with underscores, because the repeated string ;X;5 "|${(l:8::-:)}|" has the semicolons at the start to separate the commands.

brainfuck, 526 bytes
+>+[[-]<-[>+++>+<<-]>>+[<<+>>-]<[>+>+<<-]>>[<<+>>-]<<<[>>---->+<<<-]>>>[<<<+>>>-]<[[-]>>>--[<+>++++++]<---<<<[>+>>-<<<-]>[<+>-]>>[<<+>>-]++++[<++++++++>-]<<-[>.<-]+++[>+++++<-]>.-----<<[>+<-]>[<+>>..<-]-[>+<-----]>-.<-[>-<---]>+++.[-]<<+[>+>+<<-]>>[<<+>>-]<<<[>>---->+<<<-]>>>[<<<+>>>-]<]<[-]<[>+>+<<-]>>+[<<+>>-]<----------]<+[>+>+<<-]>>-[<<+>>-]<[[-]>>--[<<-->-->+++++++]<----<-[>.<-]-[>+<---]>+++++++.-<++++[>-------<-]<[>+<-]>[[<+>-]-[>-<-----]>+<]++++[>..<-]>[-]--[<+>--]<---.>-[<-->+++++++++]<.[-]<[>+>+<<-]>>-[<<+>>-]<]

Try it online!

Jelly, 55 bytes
x39_;ḤØ1jƊƲ}
⁵Ḷµ+4Ḷ++Ḥ“ /*\”çⱮYð€;ø“ |-|”ẋ12”_-¦s4ç€4µY

Try it online!

Cobra - 166 228 260
class P
    def main
        for x in 10,for n in 4+x,print' '.repeat(39-x*3-n)+'/['**'.repeat(x*3+n)]\\'
        w=' '.repeat(35)
        print'[w]|--------|\n'.repeat(11)+w+'|________|'

Python (313)
'eJztmEsOwjAMBfecoutIFUfiIjk8FAJNE3+eE0sI6qxnRq3jVZYFOlcQSwnlMPIJeqOFRNgPCsAVq9MH+Lvxhtb4DlcEgpcNUvjBr2IMyWEVQRIc3hKlk/2VYnGeqjEi4NEmJMZwrCpoUi6sErLB7W2THKPGXe9RG+3WN+tNYMA/FoYCcX9/dH+DhboxnKgiE429MhWJ3egSsRttZrLy7kxnSsih8yq5hGL9+Eqsn1TyWz+n0tZySz1ijq2UXGPQi1pey8mXoM9F38rJd5RXZaM='.decode('base64').decode('zip')

Doesn't output anything. With print,the backslashes and linefeeds seem to be missing.

C (gcc), 163 160 159 bytes
-3 -1 bytes thanks to ceilingcat.
j,w,s[99];main(i){for(;++i<12;w-=i-1)for(j=i+2;j--;)printf("%*c%.*s\\\n",40-w++,47,w*2,memset(s,42,99));for(;i--;)printf("%44s|\n",i?"|--------":"|________");}

Try it online!

Is limiting the number of printed string characters by using "%.*s" in a printf call standard behaviour?

@JonathanFrech Yep, should be. "If the
precision is specified, no more than that many bytes are written." - §7.21.6.1 of this document. (It regards fprintf, but the section on printf states that the format string works the same way as for fprintf.)

Jelly, 56 bytes
4Ḷ4ịr+L}¥¥Ɗ9Ð¡ẎḤ”*ẋ⁾/\jÐ€;⁾-_x11,1¤ẋ8⁾||jƊ€¤µLH40_⁶ẋ;µ€Y

Try it online!

PHP, 140 138 136 bytes
while($n--||30>$w+=3-$n=3+$i++)echo($p=str_pad)("",39-$w),$p("/",1|2*$w++,"*"),"\\
";while(-~$i)echo$p("",35),$p("|",9,$i--?"-":_),"|
";

less golfed:
for(;$i<10;$w-=$i)for($n=3+$i++;$n--;)
    echo str_pad("",39-$w), str_pad("/",1+2*$w++,"*"),"\\\n";
for($i++;$i--;)
    echo str_pad("",35), str_pad("|",9,$i?"-":_),"|\n";

Run with php -nr '' or try it online. Requires PHP 7.

Japt -R, 51 50 49 48 bytes
Ao*3 cÈôY+3@'\i'/+Xç*²
cCÆ'|i|+8ç"-_"gXzB})û mx1

Test it
Ao*3 cÈôY+3@'\i'/+Xç*²
A                             :10
 o                            :Range [0,A)
  *3                          :Multuply each by 3
     c                        :Flatten after ...
      È                       :  Map each X at 0-based index Y
       ôY+3                   :    Sorted range [X,X+Y+3]
           @                  :    Map each X
            '\i               :      Prepend "\" with
               '/+            :        "/" appended with
                  Xç          :          X times repeat
                    *²        :            "*" repeated twice

cCÆ'|i|+8ç"-_"gXzB})û mx1
c                             :Concatenate
 C                            :  12
  Æ                           :  Map each X in the range [0,C)
   '|i                        :    Prepend "|" with
      |+                      :      "|" appended with
        8ç                    :        8 times repeat
          "-_"g               :          Get the character in "-_" at index
               Xz             :            X floor divided by
                 B            :              11
                  }           :  End map
                   )          :End concat
                    û         :Centre pad each element with spaces to the length of the longest
                      m       :Map
                       x1     :  Trim right
                              :Implicit output, joined with newlines

05AB1E, 36 bytes
TLεÌÝN3*+'*×'/ì]˜…|--11и…|__ªº€¨«º.c

Try it online!
TLε            ]       # for y in [1 .. 10]
   ÌÝ                  #  [0 .. y+2]
     N                 #  0-based iteration count (effectively y-1)
      3*               #  times 3
        +              #  add (vectorizes over the range, yielding [3*y-3 .. 4*y-1])
         '*×           #  "*" repeated that many times (vectorizes)
            '/ì        #  prepend "/" (vectorizes)
˜                      # flatten
 …|--                  # literal "|--"
     11и               # repeated 11 times as an array
        …|__           # literal "|__"
            ª          # appended to that array
             º         # mirror (vectorizes: ["|----|", "|----|", ..., "|____|")
              €¨       # remove the last character of each
                «      # merge the two lists (["/", "/*", ..., "|----", ...])
                 º     # mirror
                  .c   # center

Deadfish~, 5411 bytes
{iii}ii{ccc}ccccccccc{i}iiiiic{iiii}iiiiic{{d}ii}ddc{ii}ii{ccc}cccccccc{i}iiiiicdddddcc{iiiii}c{{d}ii}ddc{ii}ii{ccc}ccccccc{i}iiiiicdddddcccc{iiiii}c{{d}ii}ddc{ii}ii{ccc}cccccc{i}iiiiicdddddcccccc{iiiii}c{{d}ii}ddc{ii}ii{ccc}cccccc{i}iiiiicdddddcccccc{iiiii}c{{d}ii}ddc{ii}ii{ccc}ccccc{i}iiiiicdddddcccccccc{iiiii}c{{d}ii}ddc{ii}ii{ccc}cccc{i}iiiiicddddd{c}{iiiii}c{{d}ii}ddc{ii}ii{ccc}ccc{i}iiiiicddddd{c}cc{iiiii}c{{d}ii}ddc{ii}ii{ccc}cc{i}iiiiicddddd{c}cccc{iiiii}c{{d}ii}ddc{ii}ii{ccc}ccc{i}iiiiicddddd{c}cc{iiiii}c{{d}ii}ddc{ii}ii{ccc}cc{i}iiiiicddddd{c}cccc{iiiii}c{{d}ii}ddc{ii}ii{ccc}c{i}iiiiicddddd{c}cccccc{iiiii}c{{d}ii}ddc{ii}ii{ccc}{i}iiiiicddddd{c}cccccccc{iiiii}c{{d}ii}ddc{ii}ii{cc}ccccccccc{i}iiiiicddddd{cc}{iiiii}c{{d}ii}ddc{ii}ii{cc}cccccccc{i}iiiiicddddd{cc}cc{iiiii}c{{d}ii}ddc{ii}ii{ccc}{i}iiiiicddddd{c}cccccccc{iiiii}c{{d}ii}ddc{ii}ii{cc}ccccccccc{i}iiiiicddddd{cc}{iiiii}c{{d}ii}ddc{ii}ii{cc}cccccccc{i}iiiiicddddd{cc}cc{iiiii}c{{d}ii}ddc{ii}ii{cc}ccccccc{i}iiiiicddddd{cc}cccc{iiiii}c{{d}ii}ddc{ii}ii{cc}cccccc{i}iiiiicddddd{cc}cccccc{iiiii}c{{d}ii}ddc{ii}ii{cc}ccccc{i}iiiiicddddd{cc}cccccccc{iiiii}c{{d}ii}ddc{ii}ii{cc}cccc{i}iiiiicddddd{ccc}{iiiii}c{{d}ii}ddc{ii}ii{cc}ccccccc{i}iiiiicddddd{cc}cccc{iiiii}c{{d}ii}ddc{ii}ii{cc}cccccc{i}iiiiicddddd{cc}cccccc{iiiii}c{{d}ii}ddc{ii}ii{cc}ccccc{i}iiiiicddddd{cc}cccccccc{iiiii}c{{d}ii}ddc{ii}ii{cc}cccc{i}iiiiicddddd{ccc}{iiiii}c{{d}ii}ddc{ii}ii{cc}ccc{i}iiiiicddddd{ccc}cc{iiiii}c{{d}ii}ddc{ii}ii{cc}cc{i}iiiiicddddd{ccc}cccc{iiiii}c{{d}ii}ddc{ii}ii{cc}c{i}iiiiicddddd{ccc}cccccc{iiiii}c{{d}ii}ddc{ii}ii{cc}{i}iiiiicddddd{ccc}cccccccc{iiiii}c{{d}ii}ddc{ii}ii{cc}cccc{i}iiiiicddddd{ccc}{iiiii}c{{d}ii}ddc{ii}ii{cc}ccc{i}iiiiicddddd{ccc}cc{iiiii}c{{d}ii}ddc{ii}ii{cc}cc{i}iiiiicddddd{ccc}cccc{iiiii}c{{d}ii}ddc{ii}ii{cc}c{i}iiiiicddddd{ccc}cccccc{iiiii}c{{d}ii}ddc{ii}ii{cc}{i}iiiiicddddd{ccc}cccccccc{iiiii}c{{d}ii}ddc{ii}ii{c}ccccccccc{i}iiiiicddddd{cccc}{iiiii}c{{d}ii}ddc{ii}ii{c}cccccccc{i}iiiiicddddd{cccc}cc{iiiii}c{{d}ii}ddc{ii}ii{c}ccccccc{i}iiiiicddddd{cccc}cccc{iiiii}c{{d}ii}ddc{ii}ii{c}cccccc{i}iiiiicddddd{cccc}cccccc{iiiii}c{{d}ii}ddc{ii}ii{cc}c{i}iiiiicddddd{ccc}cccccc{iiiii}c{{d}ii}ddc{ii}ii{cc}{i}iiiiicddddd{ccc}cccccccc{iiiii}c{{d}ii}ddc{ii}ii{c}ccccccccc{i}iiiiicddddd{cccc}{iiiii}c{{d}ii}ddc{ii}ii{c}cccccccc{i}iiiiicddddd{cccc}cc{iiiii}c{{d}ii}ddc{ii}ii{c}ccccccc{i}iiiiicddddd{cccc}cccc{iiiii}c{{d}ii}ddc{ii}ii{c}cccccc{i}iiiiicddddd{cccc}cccccc{iiiii}c{{d}ii}ddc{ii}ii{c}ccccc{i}iiiiicddddd{cccc}cccccccc{iiiii}c{{d}ii}ddc{ii}ii{c}cccc{i}iiiiicddddd{ccccc}{iiiii}c{{d}ii}ddc{ii}ii{c}ccc{i}iiiiicddddd{ccccc}cc{iiiii}c{{d}ii}ddc{ii}ii{c}cc{i}iiiiicddddd{ccccc}cccc{iiiii}c{{d}ii}ddc{ii}ii{c}cccccccc{i}iiiiicddddd{cccc}cc{iiiii}c{{d}ii}ddc{ii}ii{c}ccccccc{i}iiiiicddddd{cccc}cccc{iiiii}c{{d}ii}ddc{ii}ii{c}cccccc{i}iiiiicddddd{cccc}cccccc{iiiii}c{{d}ii}ddc{ii}ii{c}ccccc{i}iiiiicddddd{cccc}cccccccc{iiiii}c{{d}ii}ddc{ii}ii{c}cccc{i}iiiiicddddd{ccccc}{iiiii}c{{d}ii}ddc{ii}ii{c}ccc{i}iiiiicddddd{ccccc}cc{iiiii}c{{d}ii}ddc{ii}ii{c}cc{i}iiiiicddddd{ccccc}cccc{iiiii}c{{d}ii}ddc{ii}ii{c}c{i}iiiiicddddd{ccccc}cccccc{iiiii}c{{d}ii}ddc{ii}ii{c}{i}iiiiicddddd{ccccc}cccccccc{iiiii}c{{d}ii}ddc{ii}iiccccccccc{i}iiiiicddddd{cccccc}{iiiii}c{{d}ii}ddc{ii}iicccccccc{i}iiiiicddddd{cccccc}cc{iiiii}c{{d}ii}ddc{ii}ii{c}ccccc{i}iiiiicddddd{cccc}cccccccc{iiiii}c{{d}ii}ddc{ii}ii{c}cccc{i}iiiiicddddd{ccccc}{iiiii}c{{d}ii}ddc{ii}ii{c}ccc{i}iiiiicddddd{ccccc}cc{iiiii}c{{d}ii}ddc{ii}ii{c}cc{i}iiiiicddddd{ccccc}cccc{iiiii}c{{d}ii}ddc{ii}ii{c}c{i}iiiiicddddd{ccccc}cccccc{iiiii}c{{d}ii}ddc{ii}ii{c}{i}iiiiicddddd{ccccc}cccccccc{iiiii}c{{d}ii}ddc{ii}iiccccccccc{i}iiiiicddddd{cccccc}{iiiii}c{{d}ii}ddc{ii}iicccccccc{i}iiiiicddddd{cccccc}cc{iiiii}c{{d}ii}ddc{ii}iiccccccc{i}iiiiicddddd{cccccc}cccc{iiiii}c{{d}ii}ddc{ii}iicccccc{i}iiiiicddddd{cccccc}cccccc{iiiii}c{{d}ii}ddc{ii}iiccccc{i}iiiiicddddd{cccccc}cccccccc{iiiii}c{{d}ii}ddc{ii}iicccc{i}iiiiicddddd{ccccccc}{iiiii}c{{d}ii}ddc{ii}ii{c}cc{i}iiiiicddddd{ccccc}cccc{iiiii}c{{d}ii}ddc{ii}ii{c}c{i}iiiiicddddd{ccccc}cccccc{iiiii}c{{d}ii}ddc{ii}ii{c}{i}iiiiicddddd{ccccc}cccccccc{iiiii}c{{d}ii}ddc{ii}iiccccccccc{i}iiiiicddddd{cccccc}{iiiii}c{{d}ii}ddc{ii}iicccccccc{i}iiiiicddddd{cccccc}cc{iiiii}c{{d}ii}ddc{ii}iiccccccc{i}iiiiicddddd{cccccc}cccc{iiiii}c{{d}ii}ddc{ii}iicccccc{i}iiiiicddddd{cccccc}cccccc{iiiii}c{{d}ii}ddc{ii}iiccccc{i}iiiiicddddd{cccccc}cccccccc{iiiii}c{{d}ii}ddc{ii}iicccc{i}iiiiicddddd{ccccccc}{iiiii}c{{d}ii}ddc{ii}iiccc{i}iiiiicddddd{ccccccc}cc{iiiii}c{{d}ii}ddc{ii}iicc{i}iiiiicddddd{ccccccc}cccc{iiiii}c{{d}ii}ddc{ii}iic{i}iiiiicddddd{ccccccc}cccccc{iiiii}c{{d}ii}ddc{iiii}dddcddddd{ccccccc}cccccccc{iiiii}c{{d}ii}ddc{ii}ii{ccc}ccccc{{i}d}iic{{d}ii}icccccccc{{i}dd}dc{{d}}{d}ddddc{ii}ii{ccc}ccccc{{i}d}iic{{d}ii}icccccccc{{i}dd}dc{{d}}{d}ddddc{ii}ii{ccc}ccccc{{i}d}iic{{d}ii}icccccccc{{i}dd}dc{{d}}{d}ddddc{ii}ii{ccc}ccccc{{i}d}iic{{d}ii}icccccccc{{i}dd}dc{{d}}{d}ddddc{ii}ii{ccc}ccccc{{i}d}iic{{d}ii}icccccccc{{i}dd}dc{{d}}{d}ddddc{ii}ii{ccc}ccccc{{i}d}iic{{d}ii}icccccccc{{i}dd}dc{{d}}{d}ddddc{ii}ii{ccc}ccccc{{i}d}iic{{d}ii}icccccccc{{i}dd}dc{{d}}{d}ddddc{ii}ii{ccc}ccccc{{i}d}iic{{d}ii}icccccccc{{i}dd}dc{{d}}{d}ddddc{ii}ii{ccc}ccccc{{i}d}iic{{d}ii}icccccccc{{i}dd}dc{{d}}{d}ddddc{ii}ii{ccc}ccccc{{i}d}iic{{d}ii}icccccccc{{i}dd}dc{{d}}{d}ddddc{ii}ii{ccc}ccccc{{i}d}iic{{d}ii}icccccccc{{i}dd}dc{{d}}{d}ddddc{ii}ii{ccc}ccccc{{i}d}iic{ddd}icccccccc{iii}dc

Vyxal C, 39 bytes
₀ƛ‹3*n4*rƛ×*\/pøṀ;;\|4-mw11ẋ\|\_4*+mJJf

Try it Online!
₀ƛ                ;                     # 1...10 map...
        r                               # Range between...
  ‹3*                                   # 3(n - 1)
        r                               # And...
     n4*                                # 4n (excluded)
         ƛ       ;                      # Map to...
          ×*                            # That many asterisks
            \/p                         # Prepend a backslash
               øṀ                       # Ascii-art mirror
                         11ẋ            # 11 copies of...
                   \|4-mw               # '|--------|'
                            \|\_4*+mJ   # And a '|________|'
                                     Jf # Append to the original and flat the whole thing
                                        # (C flag) center and join by newlines

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

authors: Андрей Ивлев

authors: Дмитрий Баранов


text:
Output an Animated Trigonometry Circle
I want you to write a program that outputs a trigonometry circle like the one below. I also want you to animate this circle, having the sine line move along the circumference with the other lines move around it. The minimum number of unique frames is 5. Any lower and your entry will not be counted.

The lines you will need are:

Sine (Both)
Cosine (Both)
Secant
Cosecant
Tangent
Cotangent
OA (on diagram)

Edit: No longer a limit
This is a code golf challenge, but I want you to get your code to below my code which is written in BBC BASIC.
Note: I will remove this requirement if the challenge is too hard.
My code: BBC BASIC - 185 bytes, 232 characters (Thanks Steve)
a=0:REPEAT:CLS:a+=0.005:CIRCLE600,500,300:s=300*SIN(a)+500:c=300*COS(a)+600:sc=300*1/COS(a)+600:cs=300*1/SIN(a)+500:MOVE600,500:DRAWc,s:DRAWc,500:DRAW600,500:DRAWsc,500:DRAWc,s:MOVE600,500:DRAW600,cs:DRAWc,s:DRAW600,s:WAIT 1:UNTIL0

An image or gif of what your code produces would be very helpful.

@Calvin'sHobbies Added

I count ASCII 232 characters there, though with tokenisation it probably is 185 bytes. Watch out for that byte counter on BBC Basic for Windows. I usually post as an ASCII count. Your code is probabably golfable down below 185 ASCII characters with VDU's though.

And when the tangent or cotangent are infinite, what should be drawn? Also, what does "output" mean? Can a program write a gif or video file, or should it output in real time on a canvas?

@PeterTaylor When tan and cot are infinite, you could draw it to a very long length. Regarding the format of the output, it can be anything.

Dead link, perhaps?

@sergiol I've updated it now :)

Mathematica, 142 bytes
Graphics[{Circle[],Line/@{{{c=Cos@t,0},{c,s=Sin@t},{0,s}},{{0,0},{1/c,0},{0,1/s},{0,0},{c,s}}},},PlotRange->{r={-2,2},r}]~Animate~{t,0.01,2Pi}

I'm plotting for angles between 0.01 and 2π which conveniently skips any angles where one of the lines would become actually infinite. You can make a GIF from it by replacing Animate with Table, adding a step width of 0.1 say and then using Export on the result:

So I got a bit bored and thought I'd give the full-blown thing a go (with all lines and colours). I omitted the labels, because they are really annoying to position and just clutter everything up.
Animate[
  c = Cos@t;
  s = Sin@t;
  h = Sign@c;
  v = Sign@s;
  i = .1 h;
  j = .1 v;
  Graphics[{
    Thick,
    Circle[],
    Line /@ {{{c, -s}, {0, 0}, {c, s}}, {{-i, 0}, {-i, j}, {0,
        j}}, {{-i + c, 0}, {-i + c, j}, {c, j}}, {{c - .1 s,
        s + .1 c}, {1.1 c - .1 s, 1.1 s + .1 c}, 1.1 {c, s}}},
    Circle[{0, 0}, 0.1, {t, Round[t, Pi]}],
    Blue,
    Line /@ {{{0, 0}, {c, 0}}, {{0, s}, {c, s}}},
    Red,
    Line /@ {{{0, 0}, {0, s}}, {{c, 0}, {c, s}}},
    Darker@Green,
    Line[{{c, 0}, {h, 0}}],
    Cyan,
    Line[{{0, s}, {0, v}}],
    Lighter@Lighter@Magenta,
    Line[{{h, 0}, {1/c, 0}}],
    Darker@Darker@Green,
    Line[{{0, v}, {0, 1/s}}],
    Orange,
    Line[{{0, 1/s}, {c, s}}],
    Lighter@Brown,
    Line[{{1/c, 0}, {c, s}}],
    Gray,
    Line[{{c, 0}, {c, -s}}],
    Lighter@Gray,
    Line[{{c, s}, {h, 0}}],
    Lighter@Pink,
    Line /@ {{{-.45 h, 0}, {-.55 h, 0}}, {{-.45 h, 1/s}, {-.55 h,
        1/s}}},
    Arrowheads[{-.05, .05}],
    Arrow[{{-.5 h, 0}, {-.5 h, 1/s}}],
    Darker@Cyan,
    Line /@ {{{0, -.45 v}, {0, -.55 v}}, {{1/c, -.45 v}, {1/
         c, -.55 v}}},
    Arrow[{{0, -.5 v}, {1/c, -.5 v}}],
    Dashed,
    Black,
    Line[{{c, s}, 1.3 {c, s}}],
    Lighter@Pink,
    Line /@ {{{0, 0}, {-.5 h, 0}}, {{0, 1/s}, {-.5 h, 1/s}}},
    Darker@Cyan,
    Line /@ {{{0, 0}, {0, -.5 v}}, {{1/c, 0}, {1/c, -.5 v}}}
    }, PlotRange -> {r = {-2, 2}, r}],
  {t, 0.01, 2 Pi}
  ];

Enjoy!

And because this is still a code-golf question I golfed this down as well, to see how short I could get it. Currently, 719 bytes:
Graphics[{Thick,Arrowheads@{-.05,.05},(z=Circle)[],(n=Line)/@{{p={c=Cos@t,s=Sin@t},o={0,0},{c,-s}},{-{i=.1(h=Sign@c),0},{-i,j=.1(v=Sign@s)},{0,j}},{{-i+c,0},{-i+c,j},{c,j}},{p+(q={-.1s,.1c}),1.1p+q,1.1p}},z[o,0.1,{t,Round[t,Pi]}],{e=Dashed,n[{p,1.3p}]},Blue,n/@{{o,a={c,0}},{b={0,s},p}},Red,n/@{{o,b},{a,p}},g=(d=Darker)@Green,n@{a,{h,0}},y=Cyan,n@{b,{0,v}},(l=Lighter)@l@Magenta,n@{{h,0},f={1/c,0}},d@g,n@{{0,v},u={0,1/s}},Orange,n@{u,p},l@Brown,n@{f,p},r=Gray,n@{a,{c,-s}},l@r,n@{p,{h,0}},l@Pink,n/@{q={{-.45h,0},{-.55h,0}},{u,u}+q},Arrow@{q={-.5h,0},u+q},{e,n/@{{o,q},{u,u+q}}},d@y,n/@{q={{0,-.45v},{0,-.55v}},{f,f}+q},Arrow@{q={0,-.5v},f+q},{e,n/@{{o,q},{f,f+q}}}},PlotRange->{r={-2,2},r}]~Animate~{t,0.01,2Pi,0.05}

Nice, the colours are great!

APL (dzaima/APL), 125 bytes
P5.size←2⌿300
t←0
g←P5.G
z←0 0
P5.draw←{g.bg¯1
g.circle 3⌿90
g.ln a←90×1+z,2 1○t
g.rect a
g.ln 90×1+z,(÷2○t),z,z,⍨÷1○t
t+←.1}

Try it online!
Displays it at the top left corner:

Explanation
P5.size←2⌿300 make a 300x300 canvas
t←0 set angle \$\theta=0.\$
g←P5.G shorten drawing namespace
z←0 0 save [0,0] in z
P5.draw←{ Do the following repeatedly:
g.bg¯1 Draw a white background
g.circle 3⌿90 draw a circle of radius 90 at \$(90, 90)\$
g.ln a←90×1+z,2 1○t Line from \$(90,90)\$ to \$(90cos\theta, 90sin\theta)\$ for angle
g.rect a rectangle using the same coordinates
g.ln 90×1+z,(÷2○t),z,z,⍨÷1○t triangle with the points \$(90, 90),(90,90/cos\theta),(90/sin\theta,90)\$
t+←.1 increment angle \$\theta\$

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
Put a list in order
With a window similar to the one pictured below, you are given a list of strings, which you want to put in alphabetical order.

As shown, you have five operations:

Move up [U] - moves the selected string up one place
Move down [D] - moves the selected string down one place
Move first [F] - moves the selected string to the top of the list
Move last [L] - moves the selected string to the bottom of the list
Reverse [R] - reverses the order of the list

Using STDIN, accept a number (how many strings), followed by the unordered list of strings. Each string consists of 2-99 lower case English letters. (The example above would not be a valid input.)
Using STDOUT, print the way to put the list in order. First, mention an item to select, and then the operations(s) to perform on it in order to put the list in alphabetical order.
For example: February U December F May D D June D R D...
Explanation: Click February, move it up 1. Select December, move it to top. May, move it down twice. June, move down once, reverse the list, move down again...
Since there are obviously many valid solutions, you must choose the shortest possible. That is, choose the method with the fewest number of operations (7 in the above example).
If there's a tie among correct outputs to the input, resolve it in the following order.

Choose the one with the fewest string selections (4 in the above example).
Choose the one with the fewest operations, counting consecutive identical operations (on one string) as one (6 in the above example).
Choose the one with shortest output (least number of total characters, counting spaces).
Choose the one with the output that comes first alphabetically.

This is code-golf; the shortest submission which always produces the correct output wins.
Examples

IN 2 zz abc

OUT zz D

IN 3 cc bb aa

OUT aa R

IN 4 abc def cd ccc

OUT abc L R

IN 6 rr mm nn oo qq pp

OUT pp U rr L

Additional examples (provided by Scott Leadley, any errors are mine and not ypnypn's)
Some difficult cases:

IN => OUT
6 xx aa dd bb ee cc => dd L ee L xx L
7 aa bb ee cc dd ff gg => ee D D
8 dd ww aa bb cc xx yy zz => ww D D D dd D D D

(not the minimial number of moves, which would be cc F bb F aa F)

Permutations of 4 items aa bb cc dd with sort paths of length >1:

IN => OUT
4 aa cc dd bb => bb F D
4 aa dd cc bb => aa L R
4 bb aa dd cc => aa F cc U
4 bb dd aa cc => aa F cc U
4 bb dd cc aa => bb D D R
4 cc aa bb dd => cc D D
4 cc aa dd bb => bb F aa F
4 cc bb aa dd => dd F R
4 cc bb dd aa => dd F R
4 cc dd aa bb => bb F aa F
4 cc dd bb aa => cc D R
4 dd aa cc bb => aa L R
4 dd bb aa cc => cc F D R
4 dd bb cc aa => bb D R
4 dd cc aa bb => aa D R

Variations on a theme, 4 items aaaaa bbbb ccc dd where string length makes a difference:

IN => OUT
4 ccc dd aaaaa bbbb => ccc L dd L
4 bbbb aaaaa dd ccc => bbbb D dd D
4 bbbb dd aaaaa ccc => dd L bbbb D
4 ccc aaaaa dd bbbb => ccc L dd L
4 ccc dd bbbb aaaaa => dd F R
4 dd bbbb ccc aaaaa => ccc R D
4 dd ccc aaaaa bbbb => bbbb R D

Your example appears to contradict the spec on at least two counts: it has strings which aren't 2-99 lower-case English letters, and it has a command A which doesn't exist.

@AndoDaan Fixed. Your score is the size of your program. The rules listed above are to figure out which solution must be printed by the program.

Could you provide some sample inputs with the correct outputs?

Will the input have duplicate entries? Also it's true that moving item x up is the same as moving item x-1 down right?

Just for fun, Vim commands for all of these actions: U=ddkP, D=ddp, F=ddggP, L=ddGp, R=:g/^/m0. :P

@Claudiu Okay; done. I think these demonstrate all of the rules.

@Claudiu There will be no duplicates. That's correct.

I was hoping for more sophisticated examples. I'm having trouble figuring out how to provably find the shortest solution without a breadth-first search over all possibilities, which quickly gets ridiculous

Two comments: (1) only the third example [IN 4 abc def cd ccc] meets the input criteria of 2-99 letters/string (2) the first example [IN 2 aa b] appears to be already sorted, unless sorting is by length first, in which case the third example is wrong.

I will point out that if you want to guarantee a minimal set of operations, you are on computationally intractable ground...even knowing the minimal number of comparisons required for a sort is only known up to 15 items at present.  See "Psychic Sorting Algorithms".

For case 4 abc def cd ccc, isn't R abc F alphabetically smaller than abc L R? The ascii code of upper letters are smaller.

@Ray: You need to first select a string before any operations.

@Ypnypn I added some more test cases to your puzzle. You may want to review the answers to see if they fit your idea of what the question is.

Python 2 - 593 521
It's very brute-force with some efficiencies so it would actually finish. The 6-item list I'm testing with is taking around 5 seconds on my laptop.
$ time echo 5 xx aa dd bb ee cc | python order.py
dd L ee L xx L

real    0m4.444s
user    0m4.388s
sys 0m0.051s

Note that I'm ignoring the number in the input.  I find it useless.
import sys
def d(l,s,o,f):
 p=len(o)
 tl=tuple(l)
 if tl in s and p>=len(s[tl]) or f and p>=len(f):
  return
 if l==sorted(l):
  return o if not f or p<len(f) else None
 s[tl]=o
 x=d(l[::-1],s,o+[l[-1]+' R'],f)or f
 for n,i in enumerate(l):
  for j,k in ([(l[:n]+[l[n+1],l[n]]+l[n+2:],'D'),(l[:n]+l[n+1:]+[l[n]],'L')]if(n!=len(l)-1)else[])+([(l[:n-1]+[l[n-1],l[n]]+l[n+1:],'U'),([l[n]]+l[:n]+l[n+1:],'F')]if(n!=0)else[]):
   x=d(j,s,(o+[i+' '+k]),x)or x
 return x
print ' '.join(d(sys.stdin.read().split()[1:],{},[],[]))

Ugh, I just realized I'm not handling multiple operations on the same value correctly. I'll try to fix that.

Ruby 2.0
With the operator set [U,D,F,L], the fewest number of string selects to sort the list is the number of items in the list minus the longest common subsequence. To add the R operator, just reverse the string and apply the same rule. Unfortunately, minimizing string selects is not the same as minimizing the number of operations. For example, for an input of 8 dd ww aa bb cc xx yy zz, the correct answer is ww D D D dd D D D, but the fewest number of operations (that meets the other criteria in the question) would be cc F bb F aa F. This means that a much larger portion of the set of possible sort paths needs to be explored.

This solution uses a depth-first search strategy and alpha-beta pruning. It's important to lower the alpha value rapidly to minimize the search depth, otherwise the search tree explodes exponential. E.g. to determine the sort path with the minimum score for OP's introductory example, sorting months in calendar order to lexical order, will probably take a few decades with this program's current scoring method. The program finds the minimum number of string selects, 8, very quickly. Unfortunately, that still leaves an enormous tree to walk through.
I'm using gnome sort as my scoring function because:

it's simple to understand and modify
the scoring usually converges to the optimal alpha quickly
this implementation is faster than my LCS function implementation
it will golf better than the LCS function

Number 4 would be sufficient. Everything else is a bonus.
For a depth-first search, the order in which operations are explored has a significant impact on the search time. Since any non-empty set of N items can be sorted with ≤ N-1 F(irst) or L(ast) operations, those operations are tried first.
# gnome sort
def gnomeSort(a)
    selects = 0
    previous = nil
    i = 1
    while i < a.size
        if a[i-1] <= a[i]
            # the array a[0..i] is sorted
            i += 1      # take another bite
        else
            if a[i] != previous
                previous = a[i]
                selects += 1
            end
            a[i], a[i-1] = a[i-1], a[i]
            if (i > 1)
                i -= 1
            end
        end
    end
    return selects
end
def score(a)
    return gnomeSort(a.dup)
end

# squeeze out unnecessary operands
def consolidate(a)
    # separate operands and operators
    x = []                      # operands
    f = []                      # operators
    a.each_slice(2) { |a,b|
        x << a
        f << b
    }
    n = x.size                  # number of (operand operator) pairs
    if n>=2
        # replace all R operands with the lexically lower operand
        #   from the right or left
        f.each_with_index{|v,i|
            if v=='R'
                leftOperand = x[i-1]
                rightOperand = x[i+1]
                # handle left & right edge cases
                leftOperand = rightOperand.succ  if i==0
                rightOperand = leftOperand.succ  if i>=n-1
                x[i] = [leftOperand, rightOperand].min
            end
        }

        # replace repeated operands with <nil>
        x = x.chunk{|e|e}.map{|v|v[1].fill(nil,1)}.flatten
    end
    return [x, f]
end

@solutions = []
@operation = []
@operation[3] = ->(a, i) {
        # swap a[i] and a[i-1]
        return nil  if i<1 || i>=a.size
        v = a[i]
        a[i-1], a[i] = a[i], a[i-1]
        return [ v, 'U' ]
    }
@operation[0] = ->(a, i) {
        # move a[i] after a.last
        return nil  if i+1>=a.size
        a.push(v=a.delete_at(i))
        return [ v, 'L' ]
    }
@operation[4] = ->(a, i) {
        # reverse the whole array
        v = a[i]
        a.reverse!
        return [ v, 'R' ]
    }
@operation[1] = ->(a, i) {
        # move a[i] before a.first
        return nil  if i<=0
        a.unshift(v=a.delete_at(i))
        return [ v, 'F' ]
    }
@operation[2] = ->(a, i) {
        # swap a[i] and a[i+1]
        return nil  if i<0 || i+1>=a.size
        v = a[i]
        a[i], a[i+1] = a[i+1], a[i]
        return [ v, 'D' ]
    }

def alphaSort(depth, a, selected, selects, sortPath)
  depth += 1
  return  if selects > @alpha
  return  if selects>@alpha || selects+depth>a.size+1
  if a.each_cons(2).all?{ |x, y| x <= y }
    # found a sort path
    @alpha = selects
    @solutions << sortPath.flatten.compact
  else
    selectsFromHere = score(a)
    if @alpha > selects+selectsFromHere
      @alpha = selects+selectsFromHere
    else
    end
    @operation.each do |op|
      a.each_index do |i|
        b = a.dup
        branch = sortPath.dup << op[b,i]
        alphaSort(depth, b, a[i], selects+(selected==a[i] ? 0 : 1), branch)
      end
    end
  end
end

#       input
a = ARGF.read.scan(/\w+/m)      # alternative, $*[0].scan(/\w+/m)
a.shift                         # ignore the item count

#       depth-first search of sort operations
@alpha = [a.size-1, score(a), score(a.reverse)+1].min + 1
alphaSort(0, a, nil, 0, [])

#       winnow the set of solutions
# determine the minimum number of string selects to solve
# short-circuit if selects to solve is 0 (already sorted)
@solutions.map!{|v|consolidate v}
minSelects = @solutions.map{|v|v[0].compact.size}.min
if !minSelects
    puts
    exit
end
# keep only solutions with the minimum number of string selects
@solutions.reject!{ |v| v[0].compact.size > minSelects }

# determine the minimum number of moves in the remaining solutions
minMoves = @solutions.map{|v|v[1].size}.min
# keep only solutions with the minimum number of moves
@solutions.reject!{ |v| v[1].size > minMoves }

#       beauty contest
# turn into strings
solutions = @solutions.map{|v|v[0].zip(v[1]).flatten.compact*' '}
# keep the shortest strings
minLength = solutions.map{|v|v.size}.min
solutions.reject!{ |v| v.size > minLength }
# print the string that "that comes first alphabetically"
puts solutions.sort.first

It passes this perl TAP test suite:
use strict;
use warnings;

use Test::More qw(no_plan);
#use Test::More tests => 61;

#       solution executable
my $solver = 'ruby2.0 sortshort.rb';
my $nonTrivial = 1;

#       "happy" path

#       examples from OP
is( `echo 2 zz abc | $solver 2>&1`, "zz D\n", 'OP example #1');
is( `echo 3 cc bb aa | $solver 2>&1`, "aa R\n", 'OP example #2');
is( `echo 4 abc def cd ccc | $solver 2>&1`, "abc L R\n", 'OP example #3');
is( `echo 6 rr mm nn oo qq pp | $solver 2>&1`, "pp U rr L\n", 'OP example #4');

# example from bizangles
is( `echo 6 xx aa dd bb ee cc | $solver 2>&1`, "dd L ee L xx L\n", 'wascally wabbit, challenges deep diver (from bizangles)');

SKIP: {
  skip('non-trivial tests', 2)  unless $nonTrivial;

  # 7 item example; bizangles' python solution (circa 2014-08-22) requires higher sys.setrecursionlimit() and takes about 5 minutes
  is( `echo 7 aa bb ee cc dd ff gg | $solver 2>&1`, "ee D D\n", 'shallow');

  # minimizing the number of selects scores better than minimizing moves
  # minimizing moves                =>  cc F bb F aa F
  # minimizing selects              =>  dd D D D D ww D D D D,  ww D D D dd D D D,  ww L U U U dd D D D,  etc.
  # minimizing selects, then moves  =>  ww D D D dd D D D
  is( `echo 8 dd ww aa bb cc xx yy zz | $solver 2>&1`, "ww D D D dd D D D\n", 'joker, minimize selects before moves');
}

#       exhaustive variations on a theme with 1 item ["aa"]
is( `echo 1 aa | $solver 2>&1`, "\n", 'permutations of 1, #1');

#       exhaustive variations on a theme with 2 items ["ab", "c"]
is( `echo 2 ab c | $solver 2>&1`, "\n", 'permutations of 2, #1');
# test OP's requirement that a string be selected before reverse operation
is( `echo 2 c ab | $solver 2>&1`, "c D\n", 'permutations of 2, #2');

#       exhaustive variations on a theme with 3 items ["five", "four", "three"]
is( `echo 3 five four three | $solver 2>&1`, "\n", 'permutations of 3, #1');
is( `echo 3 five three four | $solver 2>&1`, "four U\n", 'permutations of 3, #2');
is( `echo 3 four five three | $solver 2>&1`, "five F\n", 'permutations of 3, #3');
is( `echo 3 four three five | $solver 2>&1`, "five F\n", 'permutations of 3, #4');
is( `echo 3 three five four | $solver 2>&1`, "three L\n", 'permutations of 3, #5');
is( `echo 3 three four five | $solver 2>&1`, "five R\n", 'permutations of 3, #6');

#       selected variations on a theme with 5 items ["aa", "bb", "cc", "dd", "ee"]
is( `echo 5 aa bb cc dd ee | $solver 2>&1`, "\n", 'permutations of 5, #1, already sorted');
# two sort paths of length 1
is( `echo 5 aa bb cc ee dd | $solver 2>&1`, "dd U\n", 'permutations of 5, #2, single U or D');
is( `echo 5 aa bb ee cc dd | $solver 2>&1`, "ee L\n", 'permutations of 5, #4, single L');
is( `echo 5 bb cc aa dd ee | $solver 2>&1`, "aa F\n", 'permutations of 5, #31, single F');
is( `echo 5 ee dd cc bb aa | $solver 2>&1`, "aa R\n", 'permutations of 5, #120, reverse sorted');

#       exhaustive variations on a theme with 4 items ["aa", "bb", "cc", "dd"]
# sort paths of length 0
is( `echo 4 aa bb cc dd | $solver 2>&1`, "\n", 'permutations of 4, #1');
# sort paths of length 1
is( `echo 4 aa bb dd cc | $solver 2>&1`, "cc U\n", 'permutations of 4, #2');
is( `echo 4 aa cc bb dd | $solver 2>&1`, "bb U\n", 'permutations of 4, #3');
is( `echo 4 aa dd bb cc | $solver 2>&1`, "dd L\n", 'permutations of 4, #5');
is( `echo 4 bb aa cc dd | $solver 2>&1`, "aa F\n", 'permutations of 4, #7');
is( `echo 4 bb cc aa dd | $solver 2>&1`, "aa F\n", 'permutations of 4, #9');
is( `echo 4 bb cc dd aa | $solver 2>&1`, "aa F\n", 'permutations of 4, #10');
is( `echo 4 dd aa bb cc | $solver 2>&1`, "dd L\n", 'permutations of 4, #19');
is( `echo 4 dd cc bb aa | $solver 2>&1`, "aa R\n", 'permutations of 4, #24');

# sort paths of length 2
is( `echo 4 aa cc dd bb | $solver 2>&1`, "bb F D\n", 'permutations of 4, #4');
is( `echo 4 aa dd cc bb | $solver 2>&1`, "aa L R\n", 'permutations of 4, #6');
is( `echo 4 bb aa dd cc | $solver 2>&1`, "aa F cc U\n", 'permutations of 4, #8');
is( `echo 4 bb dd aa cc | $solver 2>&1`, "aa F cc U\n", 'permutations of 4, #11');
is( `echo 4 bb dd cc aa | $solver 2>&1`, "bb D D R\n", 'permutations of 4, #12');
is( `echo 4 cc aa bb dd | $solver 2>&1`, "cc D D\n", 'permutations of 4, #13');
is( `echo 4 cc aa dd bb | $solver 2>&1`, "bb F aa F\n", 'permutations of 4, #14');
is( `echo 4 cc bb aa dd | $solver 2>&1`, "dd F R\n", 'permutations of 4, #15');
is( `echo 4 cc bb dd aa | $solver 2>&1`, "dd F R\n", 'permutations of 4, #16');
is( `echo 4 cc dd aa bb | $solver 2>&1`, "bb F aa F\n", 'permutations of 4, #17');
is( `echo 4 cc dd bb aa | $solver 2>&1`, "cc D R\n", 'permutations of 4, #18');
is( `echo 4 dd aa cc bb | $solver 2>&1`, "aa L R\n", 'permutations of 4, #20');
is( `echo 4 dd bb aa cc | $solver 2>&1`, "cc F D R\n", 'permutations of 4, #21');
is( `echo 4 dd bb cc aa | $solver 2>&1`, "bb D R\n", 'permutations of 4, #22');
is( `echo 4 dd cc aa bb | $solver 2>&1`, "aa D R\n", 'permutations of 4, #23');

#       variations on a theme with 4 items ["aaaaa", "bbbb", "ccc", "dd"]
# force choice by string length
is( `echo 4 ccc dd aaaaa bbbb | $solver 2>&1`, "ccc L dd L\n", 'permutations of 4, #17');
is( `echo 4 dd bbbb aaaaa ccc | $solver 2>&1`, "ccc F D R\n", 'permutations of 4, #21');
is( `echo 4 bbbb aaaaa dd ccc | $solver 2>&1`, "bbbb D dd D\n", 'permutations of 4, #8');
is( `echo 4 bbbb dd aaaaa ccc | $solver 2>&1`, "dd L bbbb D\n", 'permutations of 4, #11');
is( `echo 4 ccc aaaaa dd bbbb | $solver 2>&1`, "ccc L dd L\n", 'permutations of 4, #14');
is( `echo 4 ccc dd bbbb aaaaa | $solver 2>&1`, "dd F R\n", 'permutations of 4, #18');
is( `echo 4 dd aaaaa ccc bbbb | $solver 2>&1`, "aaaaa L R\n", 'permutations of 4, #20');
is( `echo 4 dd bbbb ccc aaaaa | $solver 2>&1`, "ccc R D\n", 'permutations of 4, #22');
is( `echo 4 dd ccc aaaaa bbbb | $solver 2>&1`, "bbbb R D\n", 'permutations of 4, #23');

# identical items in list
is( `echo 2 aa aa | $solver 2>&1`, "\n", '1 repeat #1');
is( `echo 3 aa aa bb | $solver 2>&1`, "\n", '1 repeat #2');
is( `echo 3 aa bb aa | $solver 2>&1`, "aa F\n", '1 repeat #3');
is( `echo 3 bb aa aa | $solver 2>&1`, "aa R\n", '1 repeat #4');
is( `echo 4 aa cc bb aa| $solver 2>&1`, "aa L R\n", '1 repeat #5');
is( `echo 5 cc bb aa bb cc | $solver 2>&1`, "aa F cc L\n", '2 repeats');

#       "sad" path

# not explicitly excluded, so cover this case
#       exhaustive variations on a theme with 0 items []
is( `echo 0 | $solver 2>&1`, "\n", 'permutations of 0, #1');

#       "bad" path
# none!

exit 0;

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
Write a program which replaces with spaces the braces in cases where braces in places cause stasis
You are a project manager. One day, one of your programmers went insane (not your fault) and took all the expressions in the codebase and added random brackets to them, before quitting on the spot, ranting about your incompetence (also not your fault). This would be an easy fix, however, for some reason you aren't using revision control (totally not your fault). And for some reason, none of the other programmers want to go through every expression to fix up the mismatched brackets (by the way, that is not your fault). Programmers these days, you think to yourself. You will have to do it yourself. The horror! Such tasks were supposed to be beneath you...
The input will be a single line, which will contain a number of left brackets (( [ {) and right brackets () ] }). It also may, but not always, contain comments (/* */) and string literals (" " or ' ') and various numbers, letters, or symbols.
There will be at least one bracket (outside of a comment or string literal) that does not have a corrosponding opposite (outside of a comment or string literal). For example, an errant } without a { prior. Another example: a ( which does not have a ) afterwards. Your program will replace with a space the minimum number of brackets required to make the brackets match up.
Examples:
(4 + (2 + 3))] ==> (4 + (2 + 3))  (the square bracket at the end)
][][[]] ==>  [][[]] (the square bracket at the start)
("Hel(o!")) ==> ("Hel(o!")  (the parenthesis at the end)
( /* )]*/ ==>   /* )]*/  (the parenthesis at the start)
{()] ==>  ()  (the curly bracket and the square bracket)

Input can be taken from whichever way is most convenient (STDIN, command line argument, reading from a file, etc.)
If there is more than one way to resolve the mismatch with the same number of removals, either is acceptable.
There will be only mismatches in brackets. String literals and comments will always be correctly formed.
The title comes from this SO thread
There will never be any quotes in comments, quotes in quotes, comments in comments, or comments in quotes.

This is code golf, so minimum number of bytes wins. Ask questions in comments if the specification is not clear.

Whoops, our edits kind of collided there. :P Everything should be fixed now.

@Doorknob Thanks for that, by the way. Didn't know how to stop SE from wiping the spaces.

Do we have to handle escaping stuff in string literals (e.g. ("foo (\") bar"))?

@Doorknob To simplify things, I'm just going to say there won't be any double quotes ever inside a string literal in the input.

Similarly, can there be quotes in a comment / a /* inside quotes / etc.? For example this is "a tricky /* input" /* it is "very tricky */

@Doorknob How about this. Quotes override comments. So in your example, everything between a and is  is a quote, and the /* and " inside that just become part of the quote. This leaves the */ on the outside as a mismatched quote, which won't every happen according to the bullet point.

Why do quotes override comments, but comments not override quotes? That seems somewhat inconsistent. It would make more sense if either a.) There will never be quotes in comments / comments in quotes, or b.) There can be both quotes in comments and comments in quotes.

@Doorknob Yeah, I suppose you're right. We'll go with the former option then, so any input where there are quotes in comments or comments in quotes will never happen. I'll edit to reflect that.

@Doorknob In most languages isn't the deal with strings comments just that what ever starts first continues until the ending delimiter is encountered?

@MartinBüttner Yes, which would be option B in my comment. But option A is simpler for the challenge.

Is the correct output for {{(}) {(}) or { } ?

@QuadmasterXLII The correct output would be {(}) (based on my definition above), but I'm inclined to let anything go for these edge cases, since they're so confusing for everybody involved :/

I would argue that the correct output for {{(}) should be {  }  or equivalent, since the opening scenario implies that the code was working to begin with, and {(}) counts as mismatched brackets in every programming language I know (i.e. "causes stasis"??). But, then, I already wrote an answer, so I'm biased.

@DLosc, that is indeed the syntactically correct answer. However, I wanted to highlight the incompetence of the project manager in the scenario.

I see. Guess I'm just not incompetent enough. ;)

Ruby, 223 characters
This one turned out a bit long.
u,b,i=[],[[],[],[]],-1
s=gets.gsub(/(\/\*|"|').*?(\*\/|"|')|~/){|m|u+=[m];?~}
s.chars{|c|i+=1
(t='{[('.index(c))?b[t].push(i):((t='}])'.index(c))&&(b[t].pop||s[i]=' '))}
b.flatten.map{|l|s[l]=' '}
puts s.gsub(/~/){u.shift}

What it does is take out the strings and comments first, so they don't get counted (and puts them back in later).
Then, it goes through the string character by character. When it finds an opening brace, it stores its position. When it finds a closing brace, it pops from its respective open brace storage array.
If pop returns nil (i.e. there weren't enough opening braces), it removes the closing brace. After this entire thing is done, it removes the remaining extra opening braces (i.e. there weren't enough closing braces).
At the end of the program, it puts all the strings and comments back and outputs them.
Ungolfed:
in_str = gets

# grab strings and comments before doing the replacements
i, unparsed = 0, []
in_str.gsub!(/(\/\*|"|').*?(\*\/|"|')|\d/){|match| unparsed.push match; i += 1 }

# replaces with spaces the braces in cases where braces in places cause stasis
brace_locations = [[], [], []]
in_str.each_char.with_index do |chr, idx|
    if brace_type = '{[('.index(chr)
        brace_locations[brace_type].push idx
    elsif brace_type = '}])'.index(chr)
        if brace_locations[brace_type].length == 0
            in_str[idx] = ' '
        else
            brace_locations[brace_type].pop
        end
    end
end
brace_locations.flatten.each{|brace_location| in_str[brace_location] = ' ' }

# put the strings and comments back and print
in_str.gsub!(/\d+/){|num| unparsed[num.to_i - 1] }
puts in_str

This is seriously impressive.  One question, though: will it still work for an input like (("string"/*comment*/)"string"?  If I'm reading (the ungolfed version) correctly, you replace strings and comments with their index in the unparsed array, which would lead to a substitution like ((12)3 and then looking for a nonexistent index 12 (or 11).  I see the golfed version just uses shift, but might it not still have a similar problem?

Python 3, 410 322 317
import re;a='([{';z=')]}';q=[re.findall('".*?"|/\*.*?\*/|.',input())]
while q:
 t=q.pop(0);s=[];i=0
 for x in t:
  if x in a:s+=[x]
  try:x in z and 1/(a[z.find(x)]==s.pop())
  except:s=0;break
 if[]==s:print(''.join(t));break
 while 1:
  try:
   while t[i]not in a+z:i+=1
  except:break
  u=t[:];u[i]=' ';q+=[u];i+=1

Tries every possible set of deletions, starting with smaller ones, until it finds one where the braces are balanced.  (By which I mean fully correctly balanced: {{(}) produces   ( ), not  {(}).)
The first version used a recursive generator function, which was really cool but also really long.  This version performs a simple breadth-first search using a queue.  (Yes, it's a factorial time algorithm.  What's the problem? :^D)

I like this one because it actually finds the least removal and produces correctly nested expressions,  but the last comment by @vonilya suggests that correct nesting isn't important. However, it is really slow if lots of braces need to be removed.

C - 406
An Attempt in C without using regular expressions.
#define A if((d==125||d==93||d==41)
char*s;t[256];f(i,m,n,p){while(s[i]!=0){int c=s[i],k=s[i+1],v=1,d;if((c==42&&k==47)||(c==m&&i>n))return i;if(!p||p==2){if((c==39||c==34)||(c==47&&k==42)){i=f(i,c*(c!=47),i,p+1);
c=c==47?42:c;}d=c+1+1*(c>50);A){v=f(i+1,d,i,2);if(!p&&v)t[d]++;if(p==2&&v)i=v;}}d=c;A&&!p){v=!!t[c];t[c]-=v;}if(p<2)putchar(c*!!v+32*!v);i++;}return 0;}main(int c,char*v[]){s=v[1];f(0,0,0,0);}

To compile and run (on a linux machine):
gcc -o brackets brackets.c
./brackets "[(])"
In undefined cases like [ ( ] ) it returns the last valid bracket pair ( )

Python 3, 320
import re
O=dict(zip('([{',')]}'))
def o(s,r,m=0,t=[]):m+=re.match(r'([^][)({}/"]|/(?!\*)|/\*.*?\*/|".*?")*',s[m:]).end();return r and o(s[:m]+' '+s[m+1:],r-1,m+1,t)or(o(s,r,m+1,t+[O[s[m]]])if s[m]in O else[s[m]]==t[-1:]and o(s,r,m+1,t[:-1]))if s[m:]else not t and s
s=input();i=0;a=0
while not a:a=o(s,i);i+=1
print(a)

Like DLosc's solution, this investigates every possible deletion, but it uses a recursive explore and fallback strategy which is a lot faster. I know that speed is not a criterion in code golf, and exhaustive search is in any case exponential, but this one can handle inputs like ({({({({({({({({(}}}}}}}} in a couple of seconds.

Well played, well played.  I did manage to get down to 317, but I think you should be able to pass that pretty easily.  (Meanwhile, my program is still churning away at your example input...)

@DLosc: Don't hold your breath :). It took my machine 58 minutes to do the version of that pattern with 6 open parens. In order to solve the stasis before the universe reaches heat-death, you'll need to memoise the queue; otherwise, you end up with an O(n!!) solution, not O(n!). (My golf is O(n*2^n) instead of O(2^n), because o actually produces all the patterns with up to r removals, instead of exactly r removals. Easy to fix, but it would cost a few characters.)


text:
One source, lots of Brainfuck
Write a Brainfuck interpreter that can interpret multiple Brainfuck programs embedded within the same source.  The syntax is the same except that the instructions must be prefixxed with the number/ID of the targetted program.  Example:
1st program
+++[->+<]

2nd program
+>++>+++.

Mashup
1+1+1+2+2>1[1-2+2+2>1>1+2+1<2+1]2+2.

What is required:

That it is theoretically able to interpret an unlimited number programs embedded within the same source.
That the instruction order does not matter.
That the code does not use features of a language that would natively solve this problem or natively interpret Brainfuck.  Pretty much, don't cheat.  I'll leave this to your discretion.

What is not:

Unlimited Brainfuck storage.  Only a minimum of 1000 Brainfuck cells per is imposed.
It is not required that the input and output specify which bf program is doing the io.  It'd be a cool feature tho, so if you do implement this you get -15 bytes.

You can do postfix if you want, just specify in that case.  This is code-golf, so the smallest source in bytes (after the the -15 byte bonus) wins.

Could you be more specific as to how input/output is handled?

shelvacu: It's the brainfuck io that I was referring to.

How will answers be scored? [tag:code-golf], [tag:popularity-context], or [tag:code-challenge]? Based on the mention of byte-count bonuses, I'm guessing [tag:code-golf], but please tag it as such.

Are the ID's only numeric?

This is a relatively minor transformation of  Interpret Brainfuck, and in my opinion is close enough to count as a duplicate.

I agree with @PeterTaylor. In practice, you only need to split the input into the groups. The rest is a normal interpreter. Not sure this is really that much of a difference.

I thought it was distinct enough, but fair enough.