text:
Upgoat or Downgoat?
Given an image of a goat, your program should best try to identify whether the goat is upside down, or not.
Examples
These are examples of what the input may be. Not actual inputs
Input:

Output:
Downgoat
Spec
Your program should be at most 30,000 bytes

The input will contain the full goat
The picture will always contain a goat
If the goat is upside down, output Downgoat, otherwise Upgoat

Input will be however you can take an image as an input (file name, base64 of the image, etc.)
Don't rely on the image name or other metadata for containing "Upgoat" or "Downgoat" as the gist file names are just for reference.

Please don't hardcode. It's boring, I can't enforce it completely but I can ask nicely.
Test Cases
Gist with images. images beginning with downgoat have Downgoat output and images beginning with upgoat have Upgoat output.
Second Batch of Test Cases
Make sure to test your images on all the test cases. These images are a jpgs. The image sizes do vary but not by that much.

Note: A few test cases may be added before accepting an answer to avoid answers which hardcode and to check the general performance of the program.
Bonus points for getting my avatar correct :P
Scoring
Score is a percent which can be calculated by: (number_correct / total) * 100

Does "fitting" count as hard-coding?

@NickT what do you mean by "fitting"?

@Downgoat coming up parameters for a model (equation) that outputs if the goat is facing the correct way. By ""fitting"" I mean fitting the model to the entire data set, versus some training set.

https://en.wikipedia.org/wiki/Overfitting

@NickT Well if it does comply with the rules you can post it. Though I will be adding a third batch of test cases and if your answer wouldn't handle different test cases too well I would advise against it (i.e. hardcoding).

I'm curious to see how these solutions will handle two goats in one picture.

Just noticed the github's captcha when creating a new account is basically this question

Mathematica, 100%, 141 bytes
f@x_:=Count[1>0]@Table[ImageInstanceQ[x,"caprine animal",RecognitionThreshold->i/100],{i,0,50}];If[f@#>f@ImageReflect@#,"Up","Down"]<>"goat"&

Well, this feels more than a little like cheating. It's also incredibly slow as well as being very silly. Function f sees roughly how high you can set the Recognition threshold in one of Mathematica's computer vision builtins, and still recognise the image as a Caprine animal.
We then see whether the image or the flipped image is more goaty. Works on your profile image only because tie is broken in favour of downgoat. There are probably loads of ways this could be improved including asking it if the image represents Bovids or other generalisations of the Caprine animal entity type.
Answer as written scores 100% for the first testing set and 94% for the second testing set, as the algorithm yields an inconclusive result for goat 1. This can be raised back up to 100% at the expense of an even longer computational time by testing more values of RecognitionThreshold. Raising from 100 to 1000 sufficies; for some reason Mathematica thinks that's a very ungoaty image! Changing the recognition entity from Caprine animal to Hoofed Mammal also seems to work.
Ungolfed:
goatness[image_] := Count[
                      Table[
                        ImageInstanceQ[
                          image, Entity["Concept", "CaprineAnimal::4p79r"],
                          RecognitionThreshold -> threshold
                        ],
                        {threshold, 0, 0.5, 0.01}
                      ],
                      True
                    ]

Function[{image},
  StringJoin[
    If[goatness[image] > goatness[ImageReflect[image]],
      "Up",
      "Down"
    ],
    "goat"
  ]
]

Alternative solution, 100% + bonus
g[t_][i_] := ImageInstanceQ[i, "caprine animal", RecognitionThreshold -> t]
f[i_, l_: 0, u_: 1] := Module[{m = (2 l + u)/3, r},
  r = g[m] /@ {i, ImageReflect@i};
  If[Equal @@ r,
   If[First@r, f[i, m, u], f[i, l, m]],
   If[First@r, "Up", "Down"] <> "goat"
   ]
  ]

This one uses the same strategy as before, but with a binary search over the threshold.  There are two functions involved here:

g[t] returns whether or not its argument is a goaty image with threshold t.
f takes three parameters: an image, and an upper and lower bound on the threshold.  It is recursive; it works by testing a threshold m between the upper and lower thresholds (biased towards the lower).  If the image and the reflected image are both goaty or non-goaty, it eliminates the lower or upper part of the range as appropriate and calls itself again.  Otherwise, if one image is goaty and the other is non-goaty, it returns Upgoat if the first image is goaty and Downgoat otherwise (if the second, reflected image is goaty).

The function definitions deserves a little explanation.  First, function application is left-associative.  This means that something like g[x][y] is interpreted as (g[x])[y]; "the result of g[x] applied to y."
Second, assignment in Mathematica is roughly equivalent to defining a replacement rule.  That is, f[x_] := x^2 does not mean "declare a function named f with parameter x that returns x^2;" its meaning is closer to, "whenever you see something like f[ ... ], call the thing inside x and replace the whole thing with x^2."
Putting these two together, we can see that the definition of g is telling Mathematica to replace any expression of the form (g[ ... ])[ ... ] with the right-hand side of the assignment.
When Mathematica encounters the expression g[m] (in the second line of f), it sees that the expression does not match any rules that it knows and leaves it unchanged.  Then it matches the Map operator /@, whose arguments are g[m] and the list {i, ImageReflect@i}.  (/@ is infix notation; this expression is exactly equivalent to Map[g[m], { ... }].)  The Map is replaced by applying its first argument to each element of its second argument, so we get {(g[m])[i], (g[m])[ ... ]}.  Now Mathematica sees that each element matches the definition of g and does the replacement.
In this way we got g to act like a function that returns another function; that is, it acts roughly like we wrote:
g[t_] := Function[{i}, ImageInstanceQ[i, "caprine animal", RecognitionThreshold -> t]]

(Except in this case g[t] on its own evaluates to a Function, whereas before g[t] on its own was not transformed at all.)
The final trick I use is an optional pattern.  The pattern l_ : 0 means "match any expression and make it available as l, or match nothing and make 0 available as l."  So, if you call f[i] with one argument (the image to test) it is as if you had called f[i, 0, 1].
Here is the test harness I used:
gist = Import["https://api.github.com/gists/3fb94bfaa7364ccdd8e2", "JSON"];
{names, urls} = Transpose[{"filename", "raw_url"} /. Last /@ ("files" /. gist)];
images = Import /@ urls;
result = f /@ images
Tally@MapThread[StringContainsQ[##, IgnoreCase -> True] &, {names, result}]
(* {{True, 18}} *)

user = "items" /.
           Import["https://api.stackexchange.com/2.2/users/40695?site=codegolf", "JSON"];
pic = Import[First["profile_image" /. user]];
name = First["display_name" /. user];
name == f@pic
(* True *)

Mathematica has a builtin for determining goats. I don't know how to feel about that.

Whaaat O.o there's a builtin for this.... Wow...

You've goat to be kidding me...

Really impressive. I had tried to exploit the asymmetry from the species detected, but failed.

+1 for Mathematica being able to see which image is "more goaty".

This is positively ridiculous. +1.

How does this program respond to two goats in one image?

Welcome to Mathematica, where there is quite literally, a built-in for everything!

JavaScript, 93.9%

var solution = function(imageUrl, settings) {

  // Settings
  settings = settings || {};
  var colourDifferenceCutoff = settings.colourDifferenceCutoff || 0.1,
      startX = settings.startX || 55,
      startY = settings.startY || 53;

  // Draw the image to the canvas
  var canvas = document.createElement("canvas"),
      context = canvas.getContext("2d"),
      image = new Image();
  image.src = imageUrl;
  image.onload = function(e) {
    canvas.width = image.width;
    canvas.height = image.height;
    context.drawImage(image, 0, 0);

    // Gets the average colour of an area
    function getColour(x, y) {

      // Get the image data from the canvas
      var sizeX = image.width / 100,
          sizeY = image.height / 100,
          data = context.getImageData(
            x * sizeX | 0,
            y * sizeY | 0,
            sizeX | 0,
            sizeY | 0
          ).data;

      // Get the average of the pixel colours
      var average = [ 0, 0, 0 ],
          length = data.length / 4;
      for(var i = 0; i < length; i++) {
        average[0] += data[i * 4] / length;
        average[1] += data[i * 4 + 1] / length;
        average[2] += data[i * 4 + 2] / length;
      }
      return average;
    }

    // Gets the lightness of similar colours above or below the centre
    function getLightness(direction) {
      var centre = getColour(startX, startY),
          colours = [],
          increment = direction == "above" ? -1 : 1;
      for(var y = startY; y > 0 && y < 100; y += increment) {
        var colour = getColour(startX, y);

        // If the colour is sufficiently different
        if(
          (
            Math.abs(colour[0] - centre[0]) +
            Math.abs(colour[1] - centre[1]) +
            Math.abs(colour[2] - centre[2])
          ) / 256 / 3
          > colourDifferenceCutoff
        ) break;
        else colours.push(colour);
      }

      // Calculate the average lightness
      var lightness = 0;
      for(var i = 0; i < colours.length; i++) {
        lightness +=
          (colours[i][0] + colours[i][1] + colours[i][2])
          / 256 / 3 / colours.length;
      }

      /*
      console.log(
        "Direction:", direction,
        "Checked y = 50 to:", y,
        "Average lightness:", lightness
      );
      */
      return lightness;
    }

    // Compare the lightness above and below the starting point
    //console.log("Results for:", imageUrl);
    var above = getLightness("above"),
        below = getLightness("below"),
        result = above > below ? "Upgoat" : "Downgoat";
    console.log(result);
    return result;
  };
};

{document.getElementById`G`.src=imageUrl=e.target.result;console.log=v=>document.getElementById`R`.textContent=v;solution(imageUrl);};r.readAsDataURL(event.dataTransfer.files[0]);" ondragover="event.preventDefault()" style="height:160px;border-radius:12px;border:2px dashed #999;font-family:Arial,sans-serif;padding:8px">
Drag & drop image file (not just link) to test here... (requires HTML5 browser)
<image style="height:100px" id="G" />

Explanation
Simple implementation of @BlackCap's idea of checking where the light is coming from.
Most of the goats are in the centre of their images, and their bellies are always darker than their backs because of the sunlight. The program starts at the middle of the image and makes a note of the colour. It then gets the average lightness of the pixels above and below the centre up to where the colour is different to the colour at the centre (when the body of the goat ends and the background starts). Whichever side is lighter determines whether it is an upgoat or a downgoat.
Fails for downgoat 9 and upgoats 7 and 9 in the second test case.

Nice! I didn't expect a 100% to be so easy. I've added a second batch of test cases, can you update your answer based on that?

Here's an alternative link does that work?

@Downgoat Yep. Score updated.

Unfortunately, it fails after I rotated the image 180° and flipped it vertically. screenshot

@mr5 Interesting... So is the image in your screenshot slightly different to downgoat 4? Also there are slight differences between browsers (and maybe operating systems?). With the parameters in this answer I got these same results for both Chrome and Firefox (using Windows).

@mr5 That's the same as flipping horizontally...

Java, 93.9% 100%
This works by determining the row contrast in the upper and lower part of the image. I assume that the contrast in the bottom half of the image is bigger for 2 reasons:

the 4 legs are in the bottom part
the background in the upper part will be blurred because it is usually the out-of-focus-area

I determine the contrast for each row by calculating the difference of neighboring pixel values, squaring the difference, and summing all squares.
Update
Some images from the second batch caused problems with the original algorithm.
upgoat3.jpg
This image was using transparency which was ignored previously. There are several possibilities to solve this problem, but I simply chose to render all images on a 400x400 black background. This has the following advantages:

handles images with alpha channel
handles indexed and grayscale images
improves performance (no need to process those 13MP images)

downgoat8.jpg/upgoat8.jpg
These images have exaggerated detail in the body of the goat. The solution here was to blur the image in vertical direction only. However, this generated problems with images from the first batch, which have vertical structures in the background. The solution here was to simply count differences which exceed a certain threshold, and ignore the actual value of the difference.
Shortly said, the updated algorithm looks for areas with many differences in images that after the preprocessing look like this:

import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.image.BufferedImage;
import java.awt.image.Raster;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;

public class UpDownGoat {
    private static final int IMAGE_SIZE = 400;
    private static final int BLUR_SIZE = 50;

    private static BufferedImage blur(BufferedImage image) {
        BufferedImage result = new BufferedImage(image.getWidth(), image.getHeight() - BLUR_SIZE + 1,
                BufferedImage.TYPE_INT_RGB);
        for (int b = 0; b < image.getRaster().getNumBands(); ++b) {
            for (int x = 0; x < result.getWidth(); ++x) {
                for (int y = 0; y < result.getHeight(); ++y) {
                    int sum = 0;
                    for (int y1 = 0; y1 < BLUR_SIZE; ++y1) {
                        sum += image.getRaster().getSample(x, y + y1, b);
                    }
                    result.getRaster().setSample(x, y, b, sum / BLUR_SIZE);
                }
            }
        }
        return result;
    }

    private static long calcContrast(Raster raster, int y0, int y1) {
        long result = 0;
        for (int b = 0; b < raster.getNumBands(); ++b) {
            for (int y = y0; y < y1; ++y) {
                long prev = raster.getSample(0, y, b);
                for (int x = 1; x < raster.getWidth(); ++x) {
                    long current = raster.getSample(x, y, b);
                    result += Math.abs(current - prev) > 5 ? 1 : 0;
                    prev = current;
                }
            }
        }
        return result;
    }

    private static boolean isUp(File file) throws IOException {
        BufferedImage image = new BufferedImage(IMAGE_SIZE, IMAGE_SIZE, BufferedImage.TYPE_INT_RGB);
        Graphics2D graphics = image.createGraphics();
        graphics.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
        graphics.drawImage(ImageIO.read(file), 0, 0, image.getWidth(), image.getHeight(), null);
        graphics.dispose();
        image = blur(image);
        int halfHeight = image.getHeight() / 2;
        return calcContrast(image.getRaster(), 0, halfHeight) < calcContrast(image.getRaster(),
                image.getHeight() - halfHeight, image.getHeight());
    }

    public static void main(String[] args) throws IOException {
        System.out.println(isUp(new File(args[0])) ? "Upgoat" : "Downgoat");
    }
}

Here's an alternative link does that work?

@Downgoat Yes, that worked. I updated the score (not including the bonus points for your avatar which is recognized correctly :).

Python 3, 91.6%
-edited with the new test cases
set filename to the goat picture you wish to test.
It uses a kernel to make an image top/bottom asymmetric.I tried the sobel operator, but this was better.
from PIL import Image, ImageFilter
import statistics
k=(2,2,2,0,0,0,-2,-2,-2)
filename='0.png'
im=Image.open(filename)
im=im.filter(ImageFilter.Kernel((3,3),k,1,128))
A=list(im.resize((10,10),1).getdata())
im.close()
a0=[]
aa=0
for y in range(0,len(A)):
    y=A[y]
    a0.append(y[0]+y[1]+y[2])
aa=statistics.mean(a0)
if aa<383.6974:
    print('Upgoat')
else:
    print('Downgoat')

+1 Nice job! I should really figure out how to install PIL on a Mac...

I've added a second batch of test cases, can you update your answer based on that?

@Downgoat just did

@Downgoat pip install Pillow

Python 3, OpenCV with Hough Transform, 100%
My original idea was to detect the vertical lines of the goat's legs and determine its vertical position relative to the body and horizon.
As it turns out, in all the images, the ground is extremely noisy, making lots of Canny edge detection output and corresponding detected lines from the Hough transform. My strategy was then to determine whether the horizontal lines lie in the upper or lower half of the image, which was enough to solve the problem.
# Most of this code is from OpenCV examples
import cv2
import numpy as np

def is_upgoat(path):
    img = cv2.imread(path)
    height, width, channels = img.shape
    gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
    edges = cv2.Canny(gray, 100, 200, apertureSize=3)

    lines = cv2.HoughLines(edges, 1, np.pi/180, 200, None, 0, 0, np.pi/2-0.5, np.pi/2+0.5)
    rho_small = 0

    for line in lines:
        rho, theta = line[0]
        a = np.cos(theta)
        b = np.sin(theta)
        x0 = a*rho
        y0 = b*rho
        x1 = int(x0 + 5000*(-b))
        y1 = int(y0 + 5000*(a))
        x2 = int(x0 - 5000*(-b))
        y2 = int(y0 - 5000*(a))

        if rho/height < 1/2: rho_small += 1
        cv2.line(img,(x1,y1),(x2,y2),(0,0,255),1, cv2.LINE_AA)

    output_dir = "output/"
    img_name = path[:-4]
    cv2.imwrite(output_dir + img_name + "img.jpg", img)
    cv2.imwrite(output_dir + img_name + "edges.jpg", edges)

    return rho_small / len(lines) < 1/2

for i in range(1, 10):
    downgoat_path = "downgoat" + str(i) + ".jpg"
    print(downgoat_path, is_upgoat(downgoat_path))

for i in range(1, 10):
    upgoat_path = "upgoat" + str(i) + ".jpg"
    print(upgoat_path, is_upgoat(upgoat_path))

Here's the entire function without outputting images:
def is_upgoat(path):
    img = cv2.imread(path)
    height, width, channels = img.shape
    gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
    edges = cv2.Canny(gray, 100, 200, apertureSize=3)

    lines = cv2.HoughLines(edges, 1, np.pi/180, 200, None, 0, 0, np.pi/2-0.5, np.pi/2+0.5)
    rho_small = 0

    for line in lines:
        rho, theta = line[0]
        if rho/height < 1/2: rho_small += 1

    return rho_small / len(lines) < 1/2

Downgoat1 edges:

Downgoat1 lines:

Upgoat2 edges and lines:

The method even worked well on particularly noisy images. Here's downgoat3 edges and lines:

Addendum
It turns out median blur and adaptive Gaussian thresholding before the Hough Transform works much better than Canny edge detection, mostly since median blur is good in noisy areas. However the problems of my original approach immediately are clear: prominent background lines are detected, as well as the goat's face in some pictures.
def is_upgoat2(path):
    img = cv2.imread(path)
    #height, width, channels = img.shape
    gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
    gray = cv2.medianBlur(gray, 19)
    thresh = cv2.adaptiveThreshold(gray, 255, cv2.ADAPTIVE_THRESH_GAUSSIAN_C,
                                   cv2.THRESH_BINARY_INV, 11, 2)

    lines = cv2.HoughLinesP(thresh, 1, np.pi / 180, threshold=100,
                            minLineLength=50, maxLineGap=10)

    vert_y = []
    horiz_y = []
    for line in lines:
        x1, y1, x2, y2 = line[0]
        # Vertical lines
        if x1 == x2 or abs((y2-y1)/(x2-x1)) > 3:
            vert_y.append((y1+y2)/2)
            cv2.line(img, (x1, y1), (x2, y2), (0, 255, 0), 2)

        # Horizontal lines
        if x1 != x2 and abs((y2-y1)/(x2-x1)) < 1/3:
            horiz_y.append((y1+y2)/2)
            cv2.line(img, (x1, y1), (x2, y2), (0, 0, 255), 2)

    print(np.median(vert_y), np.median(horiz_y))

Here's downgoat8:

Contours (code not shown) detect the top edge of the goat (spine) pretty well but fail to get the entire shape.

Further research: OpenCV has Haar-feature based object detection which is usually used for things like cars and faces, but it could probably work for goats too, given their distinctive shape.
2D Feature recognition looks promising (template matching won't work because of scaling and rotation) but I'm too lazy to figure out OpenCV for C++.

Python 3, numpy, scikit, 100%
This code runs a goat-trained image classifier against a single filename, printing out 'Upgoat' or 'Downgoat'. The code itself is one line of python3, preceded by a single gigantic string, and an import line. The giant string is actually the goat-trained classifier, which is unpickled at runtime and given the input image for classification.
The classifier was created by using the TPOT system, from Randal Olson and team at the University of Pennsylvania. TPOT helps to evolve machine-learning  image classifier pipelines using genetic programming. Basically it uses artificial selection to choose various parameters and types of classification to work best with the input data you give it, so you don't have to know much about machine learning to get a pretty good pipeline setup. https://github.com/EpistasisLab/tpot . TPOT runs on top of scikit-learn, of INRIA et al, http://scikit-learn.org/stable/
I gave TPOT about a hundred goat images that I found on the internet. I chose ones that looked relatively similar to the goats in Test, i.e. "in a field", from the side, without much else going on in the image. The output of this TPOT process was basically a scikit-learn ExtraTreesClassifier object. This image classifier, after being trained (or 'fit') on my goats, was pickled into the huge string. The string, then, contains not just classifier code, but the "imprint" of the training of all the goat images it was trained on.
I cheated slightly during training, by including the 'goat standing on a log' test image in the training images, but it still works pretty well on generic goat-in-a-field images. There seems to be a tradeoff - the longer I let TPOT run, the better classifier it created. However, better classifiers also seem to be 'bigger' and eventually run up against the 30,000 byte limit given by @Downgoat in the golf game. This program as it stands is currently at about 27kbytes. Please note that the 'second group' of test images is broken, as is the 'backup link', so I'm not sure how it would do on them. If they were to be repaired, I would probably start over, rerun TPOT and feed it a bunch of new images, and see if I could create a new classifier under 30k bytes.
Thanks

import pickle,bz2,base64,numpy,sys,skimage.transform,skimage.io
s='''
[encoded data, 26320 characters]
'''
print(['','Up','Down'][int(pickle.loads(bz2.decompress(base64.b64decode(s))).predict(numpy.array([skimage.transform.resize(skimage.io.imread(sys.argv[1],as_grey=True),(24,12),mode='constant').flatten()]))[0])]+'goat')

update: per request here is the training data, resized to 24x12 and combined into a single image for ease of upload/presentation. its over a hundred images. http://deeplearning.net/datasets/ , http://www.vision.caltech.edu/Image_Datasets/Caltech256/, duckduckgo image search, google image search, etc

Can you post your training data?

some of the original exact images i used are copyright so i cant post them all, however i have shrunk a bunch of them to the size used in the system, 24x12, and posted them in a single montage image above, which should qualify as 'fair use'.

Scikit-learn with Random Forests, 100%
The tried-and-true approach is convnets, but random forests can perform very well out-of-the-box (few parameters to tune). Here I show some general techniques in image classification tasks.
I started off with 100 images of goats for training I found through Google Images (AFAIK none in the training data match the test data). Each image is rescaled to 20x16 in grayscale, then the array is flattened to produce one row in a 2D array. A flipped version of the image is also added as a row for the training data. I did not need to use any data augmentation techniques.

Then I feed the 2D array into the random forest classifier and call predict to produce 50 decision trees. Here is the (messy) code:
RESIZE_WIDTH = 20
RESIZE_HEIGHT = 16

def preprocess_img(path):
    img = cv2.imread(path, 0)  # Grayscale
    resized_img = cv2.resize(img, (RESIZE_WIDTH, RESIZE_HEIGHT))
    return resized_img

def train_random_forest(downgoat_paths, upgoat_paths, data_paths):
    assert len(data_paths) == 100
    # Create blank image grid
    img_grid = np.zeros((10*RESIZE_HEIGHT, 10*RESIZE_WIDTH), np.uint8)

    # Training data
    TRAINING_EXAMPLES = 2*len(data_paths)
    train_X = np.zeros((TRAINING_EXAMPLES, RESIZE_WIDTH*RESIZE_HEIGHT), np.uint8)
    train_y = np.zeros(TRAINING_EXAMPLES, np.uint8)

    TEST_EXAMPLES = len(downgoat_paths) + len(upgoat_paths)
    test_X = np.zeros((TEST_EXAMPLES, RESIZE_WIDTH*RESIZE_HEIGHT), np.uint8)
    test_y = np.zeros(TEST_EXAMPLES, np.uint8)

    for i, data_path in enumerate(data_paths):
        img = preprocess_img(data_path)

        # Paste to grid
        ph = (i//10) * RESIZE_HEIGHT
        pw = (i%10) * RESIZE_WIDTH
        img_grid[ph:ph+RESIZE_HEIGHT, pw:pw+RESIZE_WIDTH] = img
        flipped_img = np.flip(img, 0)

        # Add to train array
        train_X[2*i,], train_y[2*i] = img.flatten(), 1
        train_X[2*i+1,], train_y[2*i+1] = flipped_img.flatten(), 0

    cv2.imwrite("grid.jpg", img_grid)

    clf = RandomForestClassifier(n_estimators=50, verbose=1)
    clf.fit(train_X, train_y)
    joblib.dump(clf, 'clf.pkl')

    for i, img_path in enumerate(downgoat_paths + upgoat_paths):
        test_X[i,] = preprocess_img(img_path).flatten()
        test_y[i] = (i >= len(downgoat_paths))

    predict_y = clf.predict(test_X)
    print(predict_y)
    print(test_y)
    print(accuracy_score(predict_y, test_y))

    # Draw tree 0
    tree.export_graphviz(clf.estimators_[0], out_file="tree.dot", filled=True)
    os.system('dot -Tpng tree.dot -o tree.png')

def main():
    downgoat_paths = ["downgoat" + str(i) + ".jpg" for i in range(1, 10)]
    upgoat_paths = ["upgoat" + str(i) + ".jpg" for i in range(1, 10)]
    data_paths = ["data/" + file for file in os.listdir("data")]

    train_random_forest(downgoat_paths, upgoat_paths, data_paths)

Here is the first decision tree (though since the model is in an ensemble, it is not particularly useful)

that is very interesting.... your training data seems a lot more diverse types of pictures than mine.

@donbright I would post my training data but the folder with all my pictures was on a hard drive that died. If anyone is ambitious enough, they can use reverse google image search and find the pictures I used.

thats cool. i downloaded a bunch of images but i spent a huge amount of time sorting through them for "clean" images. it is interesting to see how its possible to train based on more 'dirty' images without having to spend as much time sorting through maybe.

@donbright I believe more training data and variety is better. For "clean" and "dirty" we may use data augmentation to create "more data".


text:
Inverse Champernowne Substrings
The Champernowne Constant is the irrational number 0.1234567891011... extending  ad infinum.
We've done a question about it before. But this question is about its reciprocal, known as the Inverse Champernowne Constant. This is approximately 8.10000007.
Given a string of between one and three digits (every 3-digit string appears within the first 10,000 decimal places) inclusive, give the number of decimal places in the decimal portion of the Inverse Champernowne Constant that precede the first appearance of that string.
Builtins that perform this directly or generate approximations of either of these constants are forbidden, but builtins for arbitrary precision arithmetic are still permissible.
This is code golf, so the shortest program, in bytes, wins.
Test cases:
1 0
2 52
3 13
4 29
5 36
6 7
7 8
8 27
9 23
10 0
100 0
998 187
999 67
01 321
001 689
010 418

Could you post a file  the first 10,000 inverse Champernowne constant digits?

@orlp https://gist.github.com/SuperJedi224/9c9adad78d872e4d568f to 10,000 decimal places (your program should only look at the part to the right of the decimal point)

Can result be 1-based?

@LuisMendo The specs currently dictate 0-based

MATL, 37 bytes
Thanks to @AndrasDeak for his help with Octsympy's vpa function!
'1/'1e4:"@V]N$h1e4H$Y$t32>)I0h)jXf1)q

EDIT (June 11, 2016): due to changes in the language, replace 0 by J in the code. The link below includes that modification
Try it online!
It takes a while in the online compiler (less than 1 minute).
'1/'        % literal string
1e4:        % array [1,2,...,1e4]
"           % for each number in that array
  @V        % push number and convert to string
]           % end loop
N$h         % concatenate all strings
1e4H$Y$     % compute 1/123456789101112... as a string with 1e4 significant digits
t32>)       % remove unwanted spaces and newlines in the output string
I0h)        % remove the first two characters ('8.')
j           % input string
Xf          % find indices of occurrences of input string within computed string
1)          % take first index
q           % subtract 1

Ruby, 69 67 bytes
->x{"#{1/BigDecimal.new(?.+[*1..9999]*'')}".index(x)-3}

Score: 55 source code bytes + 12 for the -rbigdecimal flag.
Pretty straightforward. Only weird part is that the to_s implicitly called by the #{} construction on BigDecimal returns
0.81000000670 [...] 3036E1

so it's necessary to subtract 3 to get the correct index.

Python 2, 69 bytes
lambda s:str(10**30000/int("".join(map(str,range(3000))))).index(s)-1

This won't work for an input of "8".

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:
Number of steps for a binary search
Given an input of a positive integer, output the number of steps it takes to
find the input via a binary search starting at 1.
We are simulating a binary search for the integer that was given as input, in
which the simulated searcher can repeatedly guess an integer and be told
whether it is too high, too low, or correct. The strategy for finding the
integer is as follows:

Let n be the integer given as input that we are trying to find.
Start with a guess of 1. (For every guess, increment the number of steps
(regardless of whether it was correct or not), and immediately stop and
output the total number of steps if the guess was correct.)
Double the guess repeatedly until the guess is greater than n (the target
number). (Or if it is correct, but that's already covered by our
correct-guess rule mentioned above.)
Now, set an upper bound of the first power of 2 that's greater than n (i.e.
the number that was just guessed), and set a lower bound of the power of 2
directly below it.
Repeatedly guess the average (rounded down) of the upper bound and the lower
bound. If it is too high, set it as the upper bound. If it is too low, set it
as the lower bound. This procedure is guaranteed to eventually result in a
correct guess.

Here's an example, for the input of n=21:
1 -> 2 -> 4 -> 8 -> 16 -> 32 -> 24 -> 20 -> 22 -> 21
\__________________________/
   repeated doubling      \________________________/
                             repeated averaging

Since this is code-golf, the shortest code in bytes will win.
Here are all outputs from n=1 to n=100:
1
2
4
3
6
5
6
4
8
7
8
6
8
7
8
5
10
9
10
8
10
9
10
7
10
9
10
8
10
9
10
6
12
11
12
10
12
11
12
9
12
11
12
10
12
11
12
8
12
11
12
10
12
11
12
9
12
11
12
10
12
11
12
7
14
13
14
12
14
13
14
11
14
13
14
12
14
13
14
10
14
13
14
12
14
13
14
11
14
13
14
12
14
13
14
9
14
13
14
12

And here are some larger test cases:
1234 -> 21
1337 -> 22
3808 -> 19
12345 -> 28
32768 -> 16
32769 -> 32
50000 -> 28

Japt, 13 12 bytes
Oh my gosh I was beating both Jelly and Pyth for a time :D
¢a1 ªJ +1+¢l

Test it online!
Here's the strategy I use: let x be the input integer, and let b be x's binary representation. The correct output is 1 + the length of b + the last index of a 1 in b, minus 1 if this index is 0.

I told you Dennis would win.

Jelly, 18 15 10 9 bytes
B>WU;BḄBL

Try it online! or verify the small test cases and large test cases.
Background
Let n be a positive integer and m the smallest power of 2 that is greater or equal than or equal to n.

The doubling phase takes one step for each digit in the binary representation of m.
Take the binary representation of n, remove the first, most significant digit (always 1) and all trailing zeroes. The averaging phase takes one step for each remaining digit.

To avoid calculating m, we observe that, if n < m, the number of binary digits of n is exactly one less than the number of binary digits of m.
If we replace the first binary digit of n with a 0, reverse the result, append the original binary digits and remove all leading zeroes, then following happens:

If n is a power of 2, all digits of the first (modified) half get removed, leaving only the digits of the original binary representation of n = m.
If n is not a power of 2, the digit in the first half that corresponds to the most significant digit does not get removed, compensating for the fact that n has a binary digit less than m.

How it works
B>WU;BḄBL  Main link. Input: n

B          Compute the binary representation of n.
 >W        Compare it with [n].
           n is positive, so it is not less than the first binary digit and the
           comparison yields zero. When comparing lists of different length, the
           elements in the longer list that do not have a pair remain untouched.
           Therefore, this will just zero out the first binary digit.
   U       Reverse the modified binary representation.
    ;B     Concatenate it with the unmodified binary representation of n.
      ḄB   Convert from binary to integer, and back to binary.
           This removes leading zeroes.
        L  Get the length of the resulting array.

’B;Bt0L (7 bytes) works in the latest version of Jelly, using the same approach as in my Julia answer.

ES6, 38 bytes
x=>33-(g=Math.clz32)(x-1)+g(x&-x)-g(x)

As alluded to by other answers, you can calculate the number of steps from the positions of the first and last bits.
The number of steps in the doubling phase is n=33-Math.clz32(x-1). We want 2ⁿ ≥ x but n=33-Math.clz32(x) gives us 2ⁿ > x so we subtract 1 from x to compensate.
The number of steps in the averaging phase is easier, it's simply n=Math.clz32(x&-x)-Math.clz32(x). x&-x is a handy expression that evaluates to the lowest bit of x (as a power of 2).

How does x&-x work? I would have thought that it would evaluate to the absolute value of x.

I found a good explanation on this page (see bit-hack #7).

Pyth, 15 13 bytes
h-y.ElQ/PPyQ2

I have found that the number to be calculated is 1 + 2*ceil(log_2(x)) - [number of 2s in x's prime factorization, minus 1 if x is a power of 2 greater than 1].
Try it here.

Julia, 37 35 bytes
n->endof(strip(bin(n-1)bin(n),'0'))

Thanks to @AlexA. for saving 2 bytes!
This follows the observations from my Jelly answer, but deals differently with the edge cases.
If n > 1, the binary representation of n - 1 has one digit less than the one of the next power of 2, which is compensated by not removing the first digit of the binary representation of n.
By removing all zeroes from both sides, we deal with the edge case 1 as well.

Haskell, 82 bytes
This is a pretty straightforward implementation in Haskell:
f x=[j|j<-[1..],let g i|i<2=1|x>g(i-1)=2*g(i-1)|1<2=div(g(i-1)+g(i-2))2,g j==x]!!0

Less golfed:
f x = head [ stepNum | stepNum <- [1..], step stepNum == x]
  where
    prevStep i = step (i-1)
    step i | i == 1         = 1
           | x > prevStep i = 2 * prevStep i
           | otherwise      = div (prevStep i + step (i-2)) 2

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


text:
Let's play some boardgame!
Introduction
Boardgames are a classic play between kids, but there are some kids that feel bored playing a boardgame step by step. Now they want the result to be shown before they put their hands on the board.
Challenge
Suppose this boardgame: >---#<---X---<X<--#-$
>   means the start of the game
-   means a position without danger
<   means the player should return one step back
X   means the player won't move next round
#   means a portal where the player returns to the start position
$   the first player to get there or after there wins the game

The input consists of a string with the boardgame's aspects described above and two arrays with some values (from 1 to 6) in order that both players (kid A and kid B) had got when playing one cube.
Both arrays will always have the same length >= 1.
The kid A always start the game.
You must output the kid which got the end or closer to the end first.
If neither one got the end and both kids stay at the same position print 0 or any other falsy value.
If one array runs out while the other has remaining dice rolls (due to one player missing several turns on Xs), the remaining dice rolls should be used up.
For this task, you can create a program/function, that reads input from stdin, or take parameters/arguments and output/return/print the winner kid.
Since this is code-golf, shortest answer in bytes wins!
Example Input and Output
You can also use diferrent formats of input, but you should only take the boardgame, the kid-A and the kid-B values.
Example 1:
board:  >---#<---X---<X<--#-$
kid-A:  [3,6,6,5,2,1]
kid-B:  [4,5,3,5,5,5]

output: A

Explaining:
>---#<---X---<X<--#-$     # both kids in position
B--A#<---X---<X<--#-$     # kid-A moved 3 to -
B--A#<---X---<X<--#-$     # kid-B moved 4 to # and returned home
B---#<---A---<X<--#-$     # kid-A moved 6 to X and will wait one round
B---#<---A---<X<--#-$     # kid-B moved 5 to < returned one to # and returned home
>--B#<---A---<X<--#-$     # kid-B moved 3 to -
>--B#<---X---<A<--#-$     # kid-A moved 6 to < returned one to X and will wait again
>---#<--BX---<A<--#-$     # kid-B moved 5 to -
>---#<---X--B<A<--#-$     # kid-B moved 5 to < returned one to -
>---#<---X--B<X<--#A$     # kid-A moved 5 to -
>---#<---X---<X<-B#A$     # kid-B moved 5 to -
>---#<---X---<X<-B#-$A    # kid-A moved 2 and won the game!

Example 2:
board:  >-<<<<<$
kid-A:  [1,2,3]
kid-B:  [5,5,4]

output: 0

Example 3:
board:  >-<-<#<-<-<-$
kid-A:  [5,4,2]
kid-B:  [1,1,1]

output: B

Explaining:
>-<-<#<-<-<-$     # both kids in position
>-<-<#<-<-<-$     # kid-A moved 5 to # returned home
AB<-<#<-<-<-$     # kid-B moved 1 to -
>B<A<#<-<-<-$     # kid-A moved 4 to < returned one to -
>B<A<#<-<-<-$     # kid-B moved 1 to < returned one to -
AB<-<#<-<-<-$     # kid-A moved 2 to # returned home
AB<-<#<-<-<-$     # kid-B moved 1 to < returned one to -

Current position: (A:0, B:1) output: B

Can we assume that the two arrays (for A and B) will always be the same length?

If one array runs out while the other has remaining dice rolls (perhaps due to one player missing several turns on Xs), should the current position be used to determine the output, or should the remaining dice rolls be used up first?

@trichoplax. Yes, they will be always the same length.. I will clarify in the question

@trichoplax. The remaining dice rolls should be used up first

Is example 3 correct?  I run this one in my head and B never gets past space 2, while A gets to space 4.

@Draco18s. I've updated with an explanation

Ah ha.  The added explanation helps.

Perl, 188 180 + 2 = 182 bytes
Wuhuu, got to use goto.
@q=/.(?!$)/g,next if$w=$e=!@q;for(@F){a:$w+=$_;$_=$q[$w];/</?($_=-1,goto a):/X/?$e++:/#/?$w=0:!$_&&last;$e++}$r+=$"lt$r?-$w:$w;$t+=$"lt$t?-$e:$e-1}{say$w>@q?$t<0?B:A:!$r?0:$r<0?B:A

Requires -a and -E|-M5.010:
$ echo $'>-<-<#<-<-<-<-$\n5 4 2\n1 1 1' | perl -M5.010 boardgame.pl
B

Somewhat ungolfed version:
#!/usr/bin/perl -a

# Read all but last char from the board into an array
@board = /.(?!$)/g,next if $pos = $turns = !@board;
for (@F) {
    a:
    $pos+=$_;
    $_=$board[$pos];
    /</?($_=-1,goto a):
    /X/?$turns++:
    /#/?$pos=0:
    # End of Game (Victory!)
    !$_&&last;

    $turns++
}
# Make sure '$pos_diff' and '$turns_diff' are not zero by checking against [:space:]
# ' ' is less than 0 on the ascii table
$pos_diff += $"lt$pos_diff ? -$pos : $pos;
$turns_diff += $"lt$turns_diff ? -$turns : $turns-1;
}{
    say $pos>@board?
            $turns_diff<0?B
            :A
        :
        !$pos_diff?0:
        $pos_diff<0?B:
        A

Haskell, 142
_![]=fail;g!(x:y)|x>length g=Just|1<2=g!fix(\f x->case(g!!x)of;'<'->f$x-1;'X'->(0:);'#'->map$(-)(-x);_->map(+x))x y;(g?a)b=(g!)a"A"<|>(g!)b"B"

Usage:
(?) "GAME" [kidA moves] [kidB moves]

Output:
(?) ">---#<---X---<X<--#-$" [3,6,6,5,2,1] [4,5,3,5,5,5]
Just "A"

Edit:

Jikes, I golfed it to death; it fails for the last example. I'll revive it shortly.

We usually count the bytes for imports, too and I think you'll need some for fix and <|>, because they aren't in Prelude (or is there a version that includes them?).

You're right, they're not in Prelude, buuuut they are imported by default if you use lambdabot as a interpreter (I suppose counting imports are fair; I'll do that whenever I fix this)

The interpreter defines the language, so you can call the language lambdabot-Haskell or similar and exclude the byte count for the imports.


text:
Golf Me a Random Dubstep of the Day List
Aside of nursing my child, Vitsy, and dabbling in the art of code golf, I also am an avid dubstep fan, listening to all the new dubstep that Monstercat puts out as regularly as I can. I also share a random dubstep of the day, though not regularly, in the Nineteenth Byte. This last bit is what this challenge relates to; so, without further ado, let me get to what you actually need to think about:
The Challenge
You must generate a randomly sorted list of songs from this playlist in the following format:
<Title> - <Artist>: <link to the video>
Rules

The output list must update with the playlist provided, or every byte used counts as 2 (your score would be double your byte count).
The output list must have no repeats.
The output list must be given in the specified format.
The output list must have all of the videos listed in the playlist provided.
You may not use builtins for array shuffling (such as Collections.shuffle(List<?> x) from Java)
You may not use the YouTube builtin shuffle mechanism (as this is not random).
There are no limits on runtime.

Example Output
Division - Ephixa: https://www.youtube.com/watch?v=M1mPFWhgYUM&list=PLF5C76212C58C464A&index=95
Wanna Know You (ft. Holly Drummond) - Direct: https://www.youtube.com/watch?v=6QWQfzYMJTs&list=PLF5C76212C58C464A&index=24
Edge of the World (feat. Becko) - Razihel & Xilent: https://www.youtube.com/watch?v=P0dQ55ZgNkw&index=4&list=PLF5C76212C58C464A
... until the final video ...
Way Too Deep - Grabbitz: https://www.youtube.com/watch?v=4T28WgVqdrA&index=8&list=PLF5C76212C58C464A
It may be worth perusing the YouTube API, but parsing the page with the playlist on it might save you some time.

If the solution does not update with the playlist, what format is it expected to receive it in?

@user81655 There is no input whatsoever, in either case. The link for gathering the information is constant. Hardcoding the list of songs will double your byte count.

Hey, +1 for Monstercat!

What counts as a builtin for shuffling?

Like, the PHP answer does something with rand() -- where's the line?

@cat When a builtin relocates items in an array or list with a single call.

JavaScript, 532 536 538 582 bytes
Thanks to @ӍѲꝆΛҐӍΛПҒЦꝆ and @Quill for a whole bunch of bytes.
I did do a couple of things here which may not be 100% to the spec - If they aren't admissible please tell me and I'll fix them:

I shortened the YouTube URL
The shuffle is VERY weak, and is not considered in any way close to
random.
There's a bit of whitespace due to the join.

I'd like to start by saying, to any JavaScript developers out there: I'm so sorry.
New version alternates captures to reduce on regex byte cost and strips some URL length, but sacrifices on alerts. Now instead of 3, you get like 20. Unfortunately the https on the URL's seem to be required or the page won't load, though that may be my setup :/.
This could possibly be improved with proper XML parsing and loops instead of weird recursion things with calls to other functions. I had fun taking advantage of the fact that XMLHttpRequest causes synchronous execution.
d="https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&playlistId=PLF5C76212C58C464A&key={REALLY SUPER LONG GOOGLE API KEY HERE}",h=[];o=l=>{x=new XMLHttpRequest,x.open("GET",l,!1),x.send(0),j=x.responseText;y=`nextPageToken": "`;e(j)
j.includes(y)&&(q=j.split(y)[1].split('"')[0],o(d+"&pageToken="+q));h.sort(b=>.5-Math.random());alert(h.join `
`)}
e=v=>{for(r=/(title": "(.*)\[)|(oId": "(.*)")/g;null!==(m=r.exec(v));)a=m[2]+": https://youtu.be/"+r.exec(v)[4],z="] - ",a.includes(z)&&(a=a.split(z)[1]),h.push(a)}
o(d)

Replace the {REALLY SUPER LONG GOOGLE API KEY HERE} with your 39 character long YouTube API key.
Ungolfed:
//Define base URL, sacrificing speed and pages for bytes
d = "https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&playlistId=PLF5C76212C58C464A&key={REALLY SUPER LONG GOOGLE API KEY HERE}";
h = [];
o = l => {
    //Grab API data
    x = new XMLHttpRequest();
    x.open("GET", l, false);
    x.send(0);
    j = x.responseText;
    //Set up a split since we use it twice
    y = `nextPageToken": "`;
    //At this point, jump off to the other function to deal with the output
    e(j);
    //If there are multiple pages of results, as we only get a couple from each API call to save bytes with URL's
    if (j.includes(y)) {
        //Get the ID for the next page
        q = j.split(y)[1].split("\"")[0];
        //Call again with an added parameter
        o(d + "&pageToken=" + q)
    }
    //Taking advantage of XMLHttpRequest forcing this as synchronous, so all the above happens first
    //Bad shuffle
    h.sort(b => .5 - Math.random())
    alert(h.join `
        `);
}
e = v => {
    //Regex for titles/ID's - Grabbitz doesn't fit the "[Genre] - Song - Artist" mould so we need a slightly longer regex
    r = /(title": "(.*)\[)|(oId": "(.*)")/g;
    //Since we know there's one title to one video, we can run them both at the same time
    while ((m = r.exec(v)) !== null) {
        //Build the string
        a = m[2] + ": https://youtu.be/" + r.exec(v)[4];
        z = "] - ";
        //That Grabbitz edge case ruining my day again, I'm glad it's a good track...
        if (a.includes(z)) {
            a = a.split(z)[1];
        }
        h.push(a);
    }
}
o(d)

As a JavaScript developer who bears your name, I forgive you. ;) Nice post, and welcome to PPCG!

j.indexOf(y) > -1 -> j.includes(y). "nextPageToken\"\: \"" into \nextPageToken": "``

You have some accidentally unnecessary whitespace in there. Look around arrows.

Also, re is a 2-character variable. Why not use R? And try keeping only m = re.exec(v) in the for loop condition.

Oh, change a.indexOf(z)>-1?h.push(a.split(z)[1]):h.push(a) to h.push(~a.indexOf(z)?a.split(z)[1]:a). Also, since you don't seem to be using d anywhere else in your code, try moving that string to your o call at the end.

.split('"') -> .split\"``

h.toString().replace(/,/g, "\n") could become h.join\\n`, if I'm not mistaken (correct me if I'm wrong). Replace \n` with an actual newline.

@ӍѲꝆΛҐӍΛПҒЦꝆ Thanks. I implemented most of those - And I'm so embarrassed I forgot to change re to something else! Unfortunately I use d twice - Once to call the function and once for the recursion, though I may look around meta since I don't think I actually need to call the function for it to be considered legitimate in JS...

Julia, 590 bytes
using Requests
L="PLF5C76212C58C464A"
u="https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&playlistId=$L&key=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
R(x)=JSON.parse(readall(x))
F(x)=(s=x["snippet"];(s["title"],s["resourceId"]["videoId"],s["position"]))
g=get(u)
v=[F(i)for i=R(g)["items"]]
t="nextPageToken"
while haskey(R(g),t)
g=get("$u&pageToken="*R(g)[t])
v=[v;[F(i)for i=R(g)["items"]]]
end
for j=randperm(109)
t,d,i=v[j]
t=replace(t[13:end],r"\[Mo[\w ]+\]$","")
println(join(reverse(split(t," - ")),"- "),": https://www.youtube.com/watch?v=$d&list=$L&index=$(i+1)")end

This is a full program that uses Julia's Requests module to connect to the YouTube API, get the results, and print them to STDOUT. It will not likely win unless no one else participates. The X'd out portion is my Google Developer API key, which unfortunately is 39 characters.
Ungolfed:
using Requests

# Store the playlist ID
L = "PLF5C76212C58C464A"

# Store the initial API URL
u = "https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&playlistId=$L&key=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"

# Create a function for parsing JSON responses
R(x) = JSON.parse(readall(x))

# Create a function for constructing a tuple containing video information
F(x) = (s = x["snippet"]; (s["title"], s["resourceId"]["videoId"], s["position"]))

# Perform the initial API request
g = get(u)

# Collect all relevant returned information in an array
v = [F(i) for i = R(g)["items"]]

# Perform pagination to get all 109 items
t = "nextPageToken"
while haskey(R(g), t)
    g = get("$u&pageToken=" * R(g)[t])
    v = [v; [F(i) for i = R(g)["items"]]]
end

# Select the elements at random indices
for j = randperm(109)
    # Get the title, ID, and playlist index
    t, d, i = v[j]

    # Parse out the actual title
    t = replace(t[13:end], r"\[Mo[\w ]+\]$", "")

    # Print the current item
    println(join(reverse(split(t, " - ")), "- "),
            ": https://www.youtube.com/watch?v=$d&list=$L&index=$(i+1)")
end

PHP, 594 bytes
Here's my submission using PHP.
<?php $t=[];$n='';while(1){$l='https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&playlistId=PLF5C76212C58C464A&pageToken='.$n.'&key={InsertKeyToContinueOnYourAdventure!!!}';$c=json_decode(file_get_contents($l),true);$t=array_merge($c['items'],$t);if(empty($c['nextPageToken']))break;else $n=$c['nextPageToken'];}$o=[];while(count($t)){$k=rand(0,count($t)-1);$s=$t[$k]['snippet'];echo preg_replace('/(?:\[.+\] - )?(.+) - (.+)/','${2} - ${1}',$s['title']).': https://www.youtube.com/watch?v='.$s['resourceId']['videoId'].'&list='.$s['playlistId'].'
';array_splice($t,$k,1);}?>

It's probably not the best - or shortest - solution out there but it does the job. Before I go on, though, here's the ungolfed version:
<?php
$t = [];
$n = '';
while (1) {
    $l = 'https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&playlistId=PLF5C76212C58C464A&pageToken=' . $n .'&key={InsertKeyToContinueOnYourAdventure!!!}';
    $c = json_decode(file_get_contents($l), true);
    $t = array_merge($c['items'], $t);
    if (empty($c['nextPageToken']))
        break;
    else
        $n = $c['nextPageToken'];
}
$o = [];
while (count($t)) {
    $k = rand(0, count($t) - 1);
    $s = $t[$k]['snippet'];
    echo preg_replace('/(?:\[.+\] - )?(.+) - (.+)/', '${2} - ${1}', $s['title']) . ': https://www.youtube.com/watch?v=' . $s['resourceId']['videoId'] . '&list=' . $s['playlistId'] . '
';
    array_splice($t, $k, 1);
}
?>

I really feel like the regular expression can be improved - both in size and quality. Also, I couldn't think of a better way to break the first while other than that ugly if-else statement. Maybe the while statement could be handled better. I don't know. It's 1:15 am here and I'm half asleep.
Looking at the other answers, it seems that PHP probably isn't ideal for this due to its long function names. Still, file_get_contents() was pretty helpful and cut down a lot of request handling. I opted to use that instead of file() since it made decoding the request easier. I also did find a way to reduce some code around around that if-else statement, but the result would throw one notice when there was no 'nextPageToken' given on the last HTTP request. I suppose if you wanted to turn error reporting off then it could be possible, but I felt like that would be cheating. For those who are curious, the ungolfed if-else would look like this:
if ($d = $c['nextPageToken']))
    break;
else
    $n = $d;

Edit: I just realised that if this were to be run from a console I could reduce the size by 11 bytes (removing php tags + replacing br/ tag with \n). Oh well, at least's more readable on a browser IMHO. I'll just leave it for now.

First code golf! Woooo! Now I must sleep. Good night, y'all!

Haha at least PHP throws a notice instead of outright throwing a tantrum like JS does when it can't find something to pull out of the toy pit.


text:
Convert English to a number without built-ins or libraries
This challenge is similar to this other, however I made a restriction (see bold text below) that I think would made it much diffent and (I hope) fun either.
The Challenge
Write a program or a function in any programming language that takes as input the English name of a positive integer n not exceeding 100 and returns n as an integer.
Standard loopholes are forbidden and you cannot use any built-in function, external tool, or library that already does this job.
Shortest source code in bytes wins.
Test
Here all the input->output cases:
one              -> 1
two              -> 2
three            -> 3
four             -> 4
five             -> 5
six              -> 6
seven            -> 7
eight            -> 8
nine             -> 9
ten              -> 10
eleven           -> 11
twelve           -> 12
thirteen         -> 13
fourteen         -> 14
fifteen          -> 15
sixteen          -> 16
seventeen        -> 17
eighteen         -> 18
nineteen         -> 19
twenty           -> 20
twenty-one       -> 21
twenty-two       -> 22
twenty-three     -> 23
twenty-four      -> 24
twenty-five      -> 25
twenty-six       -> 26
twenty-seven     -> 27
twenty-eight     -> 28
twenty-nine      -> 29
thirty           -> 30
thirty-one       -> 31
thirty-two       -> 32
thirty-three     -> 33
thirty-four      -> 34
thirty-five      -> 35
thirty-six       -> 36
thirty-seven     -> 37
thirty-eight     -> 38
thirty-nine      -> 39
forty            -> 40
forty-one        -> 41
forty-two        -> 42
forty-three      -> 43
forty-four       -> 44
forty-five       -> 45
forty-six        -> 46
forty-seven      -> 47
forty-eight      -> 48
forty-nine       -> 49
fifty            -> 50
fifty-one        -> 51
fifty-two        -> 52
fifty-three      -> 53
fifty-four       -> 54
fifty-five       -> 55
fifty-six        -> 56
fifty-seven      -> 57
fifty-eight      -> 58
fifty-nine       -> 59
sixty            -> 60
sixty-one        -> 61
sixty-two        -> 62
sixty-three      -> 63
sixty-four       -> 64
sixty-five       -> 65
sixty-six        -> 66
sixty-seven      -> 67
sixty-eight      -> 68
sixty-nine       -> 69
seventy          -> 70
seventy-one      -> 71
seventy-two      -> 72
seventy-three    -> 73
seventy-four     -> 74
seventy-five     -> 75
seventy-six      -> 76
seventy-seven    -> 77
seventy-eight    -> 78
seventy-nine     -> 79
eighty           -> 80
eighty-one       -> 81
eighty-two       -> 82
eighty-three     -> 83
eighty-four      -> 84
eighty-five      -> 85
eighty-six       -> 86
eighty-seven     -> 87
eighty-eight     -> 88
eighty-nine      -> 89
ninety           -> 90
ninety-one       -> 91
ninety-two       -> 92
ninety-three     -> 93
ninety-four      -> 94
ninety-five      -> 95
ninety-six       -> 96
ninety-seven     -> 97
ninety-eight     -> 98
ninety-nine      -> 99
one hundred      -> 100

What about a built-in that does half the job, for example finding the unicode name of a codepoint.

@BradGilbertb2gills No, it is not fine.

C, 160 bytes
g(char*s){char i=1,r=0,*p="k^[#>Pcx.yI<7CZpVgmH:o]sYK$2";for(;*s^'-'&&*s;r+=*s++|9);r=r%45+77;for(;*p!=r;p++,i++);return((*s^'-')?0:g(s+1))+(i<21?i:10*(i-18));}

Test it
int main ()
{
    char* w[] = {"", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen", "twenty", "twenty-one", "twenty-two", "twenty-three", "twenty-four", "twenty-five", "twenty-six", "twenty-seven", "twenty-eight", "twenty-nine", "thirty", "thirty-one", "thirty-two", "thirty-three", "thirty-four", "thirty-five", "thirty-six", "thirty-seven", "thirty-eight", "thirty-nine", "forty", "forty-one", "forty-two", "forty-three", "forty-four", "forty-five", "forty-six", "forty-seven", "forty-eight", "forty-nine", "fifty", "fifty-one", "fifty-two", "fifty-three", "fifty-four", "fifty-five", "fifty-six", "fifty-seven", "fifty-eight", "fifty-nine", "sixty", "sixty-one", "sixty-two", "sixty-three", "sixty-four", "sixty-five", "sixty-six", "sixty-seven", "sixty-eight", "sixty-nine", "seventy", "seventy-one", "seventy-two", "seventy-three", "seventy-four", "seventy-five", "seventy-six", "seventy-seven", "seventy-eight", "seventy-nine", "eighty", "eighty-one", "eighty-two", "eighty-three", "eighty-four", "eighty-five", "eighty-six", "eighty-seven", "eighty-eight", "eighty-nine", "ninety", "ninety-one", "ninety-two", "ninety-three", "ninety-four", "ninety-five", "ninety-six", "ninety-seven", "ninety-eight", "ninety-nine", "one hundred"};

    int n;
    for (n = 1; n <= 100; n++)
    {
        printf ("%s -> %d\n", w[n], g(w[n]));
        if (n != g(w[n]))
        {
            printf ("Error at n = %d", n);
            return 1;
        }
    }
    return 0;
}

How it works
After some attempts, I found a function that maps the "exceptional" numbers one, two, three, four, five, six, seven, eight, nine, ten, eleven, twelve, thirteen, fourteen, fifteen, sixteen, seventeen, eighteen, nineteen, twenty, thirty, forty, fifty, sixty, seventy, eighty, ninety, one hundred, to the printable ASCII characters k, ., [, <, *, , c, K, w, y, e, (, S, _, -, C, ), 7, =, 4, &, o, ], s, Y, g, m, N, respectively.
This function is:
char hash (char* s)
{
    char r = 0;

    while (*s)
    {
        r += *s|9;
        s++;
    }

    return r%45+77;
}

The golfed program computes the hash function of the input until it reaches the end of the string or the character -. Then it searches the hash in the string k.[<* cKwye(S_-C)7=4&o]sYgmN and determines the corresponding number. If the end of the input string was reached the number is returned, if instead a - was reached, then it is returned the number plus the result of the golfed program applied to the rest of the input string.

I'm thinking, if there were a golfing version of C, it might actually beat languages like CJam Pyth Japt etc...

JavaScript (ES6), 175 166 163 156 153 147 bytes
Saved 7 bytes thanks to @Neil
a=>+a.replace(/.+te|.*el|y$/,x=>x[1]?'on-'+x:'-d').split(/ |-|dr/).map(x=>"un|d,on|le,w,th,fo,f,x,s,h,i,".split`,`.findIndex(y=>x.match(y))).join``

Verify it here:

f=a=>+a.replace(/.+te|.*el|y$/,x=>x[1]?'on-'+x:'-d').split(/ |-|dr/).map(x=>"un|d,on|le,w,th,fo,f,x,s,h,i,".split`,`.findIndex(y=>x.match(y))).join``;

document.body.innerHTML="
"+["one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen","twenty","twenty-one","twenty-two","twenty-three","twenty-four","twenty-five","twenty-six","twenty-seven","twenty-eight","twenty-nine","thirty","thirty-one","thirty-two","thirty-three","thirty-four","thirty-five","thirty-six","thirty-seven","thirty-eight","thirty-nine","forty","forty-one","forty-two","forty-three","forty-four","forty-five","forty-six","forty-seven","forty-eight","forty-nine","fifty","fifty-one","fifty-two","fifty-three","fifty-four","fifty-five","fifty-six","fifty-seven","fifty-eight","fifty-nine","sixty","sixty-one","sixty-two","sixty-three","sixty-four","sixty-five","sixty-six","sixty-seven","sixty-eight","sixty-nine","seventy","seventy-one","seventy-two","seventy-three","seventy-four","seventy-five","seventy-six","seventy-seven","seventy-eight","seventy-nine","eighty","eighty-one","eighty-two","eighty-three","eighty-four","eighty-five","eighty-six","eighty-seven","eighty-eight","eighty-nine","ninety","ninety-one","ninety-two","ninety-three","ninety-four","ninety-five","ninety-six","ninety-seven","ninety-eight","ninety-nine","one hundred"].map((x,y)=>'f("'+x+'") === '+f(x)+"? "+(f(x)===y+1)).join("
")+"
"

How it works
The basic idea is to split each number into its digit-words, then map each word to the corresponding digit. Almost all of the words are set up to be matched properly with a simple regex, but there are a few anomalies:

eleven through nineteen: if the word contains an el, or a te in the middle (to avoid ten), we add a on- to the beginning, changing these to on-eleven through on-nineteen.
twenty, thirty, etc.: replacing a trailing y with -d changes these to twent-d, thirt-d, etc.

Now we split at hyphens, spaces, and drs. This splits everything from 11 to 99 into its corresponding digit-words, and "one hundred" into [one,hun,ed]. Then we map each of these words through an array of regexes, and keep the index of the one that matches first.
0: /un|d/ - This matches the "hun" and "ed" in 100, as well as the "d" we placed on the end of 20, 30, etc.
1: /on|le/ - Matches "one" and the "on" we placed on the beginning of 11 through 19, along with "eleven".
2: /w/ - Matches "two", "twelve", and "twenty".
3: /th/ - Matches "three" and "thirty".
4: /fo/ - Matches "four" and "forty".
5: /f/ - "five" and "fifty" are the only words by now that contain an "f".
6: /x/ - "six" and "sixty" are the only words that contain an "x".
7: /s/ - "seven" and "seventy" are the only words by now that contain an "s".
8: /h/ - "eight" and "eighty" are the only words by now that contain an "h".
9: /i/ - "nine" and "ninety" are the only words by now that contain an "i".
10: /<empty>/ - "ten" is the only word left, but it still has to be matched.

By now, each and every input will be the array of the proper digits. All we have to do is join them with join`` , convert to a number with unary +, and we're done.

Please, explain.

@Bob Sure, explanation added.

Doesn't .findIndex(y=>x.match(y)) work?

@Neil I didn't realize that would, but it does, thanks!

I'm pretty sure you can alias replace.

@ӍѲꝆΛҐӍΛПҒЦꝆ Exactly the same length :( a=>+a[r="replace"](/(.+)te/,'on-$1')[r](/y$/,'-d')...

@ӍѲꝆΛҐӍΛПҒЦꝆ Fortunately, combining the two replaces saved three bytes!

sh + coreutils, 112 bytes
Can be run on all testcases at once, one per line.
sed -r "`awk '$0="s/"$0"/+"NR"/g"'<<<"on
tw
th
fo
fi
si
se
ei
ni
te|lv
el"`
s/ /y0/
s/y/*10/
s/^\+|[a-z-]//g"|bc

Explanation
The backticked awk evaluates to the sed script
s/on/+1/g       # one, one hundred
s/tw/+2/g       # two, twelve, twenty
s/th/+3/g       # three, thirteen, thirty
s/fo/+4/g       # ...
s/fi/+5/g
s/si/+6/g
s/se/+7/g
s/ei/+8/g
s/ni/+9/g
s/te|lv/+10/g   # ten, -teen, twelve
s/el/+11/g      # eleven

which transforms parts of numbers into their numeric representation.
fife            ->    +5ve
ten             ->    +10n
eleven          ->    +11even
twelve          ->    +2e+10e
sixteen         ->    +6x+10en
thirty-seven    ->    +3irty-+7ven
forty-four      ->    +4rty-+4ur
eighty          ->    +8ghty
one hundred     ->    +1e hundred

The additional lines of the sed script
s/ /y0/
s/y/*10/

take care of -tys and one hundred.
+3irty-+7ven    ->    +3irt*10-+7ven
+4rty-+4ur      ->    +4rt*10-+4ur
+8ghty          ->    +8ght*10
+1e hundred     ->    +1ey0hundred      ->    +1e*100hundred

Finally, remove leading +s and everything that is not +, * or a digit.
s/^\+|[a-z-]//g"

Only math expressions remain
fife            ->    5
sixteen         ->    6+10
forty-four      ->    4*10+4
eighty          ->    8*10
one hundred     ->    1*100

and can be piped into bc.

Pyth, 79 76 75 68 bytes
Thank @ETHproductions for 7 bytes.
?}"hu"z100sm*+hxc."ewEÐ¡Bu["2<d2?|}"een"d}"lv"dTZ?}"ty"dT1cz\-

Basically first checks the corner case of 100, then uses an array of the first two letters of the numbers 0 to 11 to determine the semantics of the input and modify the value according to suffix ("-ty" and "-teen"; "lv" in 12 is another corner case). First splits input into a list of words, then map each one to a value, and sum them up.
In pythonic pseudocode:
                           z = input()    # raw, unevaluated
                           Z = 0
                           T = 10
?}"hu"z                    if "hu" in z:  # checks if input is 100
  100                        print(100)
                           else:
sm                           sum(map( lambda d: # evaluates each word, then sum
  *                            multiply(
   +hxc."ewEÐ¡Bu["2<d2           plusOne(chop("ontwth...niteel",2).index(d[:2])) + \
                                 # chops string into ["on","tw",..."el"]
                                 # ."ewEÐ¡Bu[" is a packed string
     ?|}"een"d}"lv"dTZ               (T if "een" in d or "lv" in d else Z),
                                     # add 10 for numbers from 12 to 19
   ?}"ty"dT1                     T if "ty" in d else 1),  # times 10 if "-ty"
  cz\-                         z.split("-"))  # splits input into words

Test suite

Python 3, 218 bytes
z=input()
if "hu" in z:print(100);exit()
print(sum(map(lambda d:([0,"on","tw","th","fo","fi","si","se","ei","ni","te","el"].index(d[:2])+(10 if "een" in d or "lv" in d else 0))*(10 if "ty" in d else 1),z.split("-"))))

Basically identical to the Pyth answer.

Off-topic:
I just discovered a meaningful version of the answer to life, the universe and everything: it's tea-thirsty twigs. Wow, twigs that yearn for tea! I'm not sure how many other answers do this, but for my answer if the input is "tea-thirsty-twigs" the output is 42.

I believe you can save seven bytes by using a packed string. Copy the output and put it in place of "ontwthfofisiseeiniteel" in this program.

@ETHproductions Wow, thanks! The last time I checked, there was still "ze" at the head of the string, and packing couldn't work. I didn't check once more after I golfed it out. Again, thanks xD

@ETHproductions yes I actually did, it's under the pseudocode.

Haskell, 252 231 bytes
let l=words;k=l"six seven eight nine";w=l"one two three four five"++k++l"ten eleven twelve"++((++"teen")<$>l"thir four fif"++k)++[n++"ty"++s|n<-l"twen thir for fif"++k,s<-"":['-':x|x<-take 9w]]in maybe 100id.flip lookup(zip w[1..])

This creates a list of all English number names from "one" to "ninety-nine" and then looks the index of the input up. If it doesn't exist, we're in the edge case "one hundred", so it returns 100, otherwise it's going to return the index.
Ungolfed
-- k in the golfed variant
common = words "six seven eight nine"

-- w in the golfed variant
numbers = words "one two three four five" ++ common
       ++ words "ten eleven twelve" ++ [p ++ "teen" | p <- words "thir four fif" ++ common]
       ++ [p ++ "ty" ++ s| p <- words "twen thir for fif" ++ common
                         , s <- "" : map ('-':) (take 9 numbers)]

-- part of the expression in the golfed variant
convert :: String -> Int
convert s = maybe 100 id $ lookup s $ zip numbers [1..]

Python 3, 365 361 310 303 characters
Golfed
def f(a):
 y=0
 for i in a.split("-"):
  x="one,two,three,four,five,six,seven,eight,nine,ten,eleven,twelve,thir;four;fif;six;seven;eigh;nine;twenty,thirty,forty,fifty,sixty,seventy,eighty,ninety,one hundred".replace(";","teen,").split(",").index(i)
  y+=x+1 if x<20 else range(30,110,10)[x-20]
 return y

Ungolfed
 def nameToNumber (numberName):
    names = ["one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve","thirteen",
             "fourteen","fifteen","sixteen","seventeen","eighteen","nineteen","twenty","thirty","forty","fifty",
             "sixty","seventy","eighty","ninety","one hundred"]
    numbers = range(30, 110, 10)
    number = 0
    for n in numberName.split("-"):
        x = names.index(n)
        number += x + 1 if x < 20 else numbers[x - 20]
    return number

45 characters shorter: n="one,two,three,four,five,six,seven,eight,nine,ten,eleven,twelve,thirteen,fourteen,fifteen,sixteen,seventeen,eighteen,nineteen,twenty,thirty,forty,fifty,sixty,seventy,eighty,ninety,one hundred".split(",") But as I see, should work without assigning it to variable n, just call .index() directly on it.

7 characters shorter: "one,two,three,four,five,six,seven,eight,nine,ten,eleven,twelve,thir;four;fif;six;seven;eigh;nine;twenty,thirty,forty,fifty,sixty,seventy,eighty,ninety,one hundred".replace(";","teen,").split(",").

The StackExchange site engine has an irritating habit: it inserts invisible characters (U200C Zero Width Non-Joiner and U200B Zero Width Space) into the code posted in comments. You copy-pasted them too. I edited your post to remove them.

Python 2, 275 characters
def x(n):a='one two three four five six seven eight nine ten eleven twelve'.split();t='twen thir four fif six seven eigh nine'.split();b=[i+'teen'for i in t[1:]];c=[i+'ty'for i in t];return(a+b+[i+j for i in c for j in ['']+['-'+k for k in a[:9]]]+['one hundred']).index(n)+1

It simple builds a list of every number and finds the index.

Perl, 158 bytes
@s=split/(\d+)/,'te1ten0l1le1on1tw2th3fo4fi5si6se7ei8ni9d00';foreach(split'-',$n=$ARGV[0]){for($i=0;$i<$#s;$i+=2){m/$s[$i]/&&print$s[$i+1]}}$n=~/ty$/&&print 0

Runs from the command line. one hundred must be entered as "one hundred" to stop it being interpreted as two inputs.

Japt, 82 bytes
+Ur`(.+)¿``¿-$1` r"y$""-d" q$/ |-|dr/$ £`un|Üaiwo|ØÏ¿ifoifix¿iÊ¿¿e¿iv`qi b_XfZ}Ãq

Each ¿ represents an unprintable char. Test it online!
Based on my JS answer. Subtract one byte if the output doesn't need to be an integer, since it would appear exactly the same as a string.
How it works
+Ur`(.+)¿` `¿-$1`  r"y$""-d" q/ |-|dr/ £  `un|Üaiwo|ØÏ¿ifoifix¿iÊ¿¿e¿iv`          qi b_ XfZ}Ã q
+Ur"(.+)te""on-$1" r"y$""-d" q/ |-|dr/ mX{"un|dioniwo|wenithifoifixisihineiteiniv"qi bZ{XfZ}} q

Ur"(.+)te""on-$1" // Replace "thirteen", "fourteen", etc. with "on-thiren", "on-fouren", etc.
r"y$""-d"         // Replace "twenty", "thirty", etc. with "twent-d", "thirt-d", etc.
q/ |-|dr/         // Split at occurances of a space, hyphen, or "dr". By now,
                  // "one", "thirteen", "twenty", "sixty-six", "one hundred" will have become:
                  // "one", "on" "thiren", "twent" "d", "sixty" "six", "one" "hun" "ed"
mX         }      // Map each item X in the resulting array to:
"..."qi           //  Take this string, split at "i"s,
b_XfZ}            //  and find the first item Z where X.match(RegExp(Z)) is not null.
                  //  See my JS answer to learn exactly how this works.
                  // Our previous example is now
                  // "1", "1" "3", "2" "0", "6" "6", "1" "0" "0"
+              q  // Join and convert to integer.
                  // 1, 13, 20, 66, 100

JavaScript, 214 199 bytes
As always: turns out this is too long to compete, but now that I'm done it'd be a waste not to post this.
Perhaps there's an obvious way to golf this further that I've overlooked?
e=s=>s.slice(-1)=='d'?100:'  ontwthfofisiseeinite'.indexOf(s.slice(0,2))/2;f=s=>([t,u]=s.split('-'),~s.indexOf`le`?11:~s.indexOf`lv`?12:e(t)+(t.slice(-3)=='een')*10+''+(u?e(u):t.slice(-1)=='y'?0:''))

JSFiddle for test cases

How about changing f to f=s=>([t,u]=s.split('-'),~s.indexOf('le')?11:~s.indexOf('lv')?12:e(t)+(t.slice(-3)=='een')*10+''+(u?e(u):t.slice(-1)=='y'?0:''))? Also, a single string argument can be passed to a function like so: s.indexOf`lv`

@ETHproductions That's great, thanks! I didn't know JS had a comma operator, and the shorthand for string passing is really useful as well.


text:
A small language deserves a small interpreter
Here is a very simple language definition:
A Variable is any string that does not contain ^, <, >, !, or ?
The empty string is a valid variable identifier
The value of every variable starts at 0.
A Statement is one of (var is a Variable, P is a Program):
    var^   -> changes var to be equal to 1 more than itself
    var
 -> while var > 0, changes var to be equal to 1 less than itself, then runs P
    var! -> output value of var
    var? -> ask for non-negative integer as input, increase var by that value
A Program is a concatenation of Statements, running a Program means running each Statement in order

Example programs (note that the empty string is a variable, but I will use it sparingly for the sake of clarity, and some variables are zeroed out in the program when they are usually 0 by default):
<>: sets the value of the empty string variable to 0
b<>b?b: asks for b, then adds the value stored in b to a, zeroing b in the process
b<>b?a<>b: asks for b, then sets a to the value of b, zeroing b in the process
a<>c<>bc : copies the value in b into a without zeroing it
b<>c<>a<c^c^c>b! : outputs a multiplied by 2
b^b<a<>a?a!b^> : outputs what you input, forever

Your goal is to write the smallest interpreter for this language.

The value of a variable can be arbitrarily large and should only be limited by the total memory your language has access to, in theory, but you are only required to handle values up to 2^256.
Your program should be able to handle arbitrarily long programs, in theory, but you will only be required to work on programs under 2^32 characters long. You are required to handle nested loops of depth up to 2^32 as well.
You can assume that the program is a valid program, and that you will only ever get non-negative integers when you ask for input. You can also assume that only ASCII printable characters are included in the input string.
The speed of the program you interpret doesn't matter, it will already be painfully slow for things as simple as 5-digit multiplication, without optimization.
If you want to use a language which cannot reasonably accept input or produce output in the way described by the language, use any interpretation you want to make it possible. This applies to any reason your language can't implement some required behavior. I want all languages to be able to compete.
Shortest program wins. Standard loopholes apply.

As a side challenge I want to see how short a program I can write that outputs the number 2016, but first I need to wait for an interpreter to be written so that I can test my code.

I have an interpreter in Python 2.7 here.

What is this language called? It deserves a place at http://esolangs.org

@Neil I managed to do it in 72 characters

@FricativeMelon 72? I can do it in 43!

@Neil I've gotten mine down to 39

@FricativeMelon Looks like you've got me beat; 726262 took me 45, while 822(824-1) took me 43.

@Neil 60415263063373835637355132068513997507264512000000000 is a heck of a lot of characters

@FricativeMelon 72829 is also 43, but I've now found 73834, which is only 42...

@FricativeMelon At last, I've managed 39: ^^^^a<^^^^>a<cb<c^^>>!

I don't think any of the answers actually support 256-bit variables.

Ruby, 182 bytes
$h=Hash.new 0
def r(c)c.scan(/(([^!?^<>]*)(<(\g<1>*)>|[!?^]))/){$4?($1=~/(.*?)<(.*)>/
($h[$1]-=1;r$2)while$h[$1]>0):$3<?"?p($h[$2]):$h[$2]+=$3<?@?STDIN.gets.to_i:
1}end
r IO.read *$*

Try it like this:
$ cat code
a?b<>c<>a<c^c^c>b!

$ ruby lynn.rb code
3                           <-- input
6                           <-- output

How it works
The r function tokenizes an input string and executes each token:
def r(c)
    c.scan(/(([^!?^<>]*)(<(\g<1>*)>|[!?^]))/){
        ...
    }
end

We look for some variable name $2 matching [^!?^<>]*, followed by either

<...> where ... matches zero or more programs (\g is recursion), in which case $4 isn't nil
A !, ?, or ^ character, captured by $3, in which case $4 is nil.

Then the logic for executing a token is quite simple when indenting it a bit:
$4 ? (                                    # If it's a loop:
    $1 =~ /(.*?)<(.*)>/                   #   Re-match token*
    ($h[$1]-=1; r $2) while $h[$1] > 0    #   Recurse to run loop
) :                                       # Else:
    $3 < ?"                               #   If it's an !:
      ? p($h[$2])                         #     Print the var
      : $h[$2] +=                         #   Else, increment it by:
          $3 < ?@                         #     If it's a ?:
              ? STDIN.gets.to_i           #       User input
              : 1                         #     Else: 1

* There's an oniguruma bug, I think, that keeps me from simply using $3 here.

I am really curious how this works.

C++, 301
Thanks to @ceilingcat for some very nice pieces of golfing - now even shorter
#import<bits/stdc++.h>
std::map<std::string,long>V;int r(char*s){char*p;for(long c;*s;s=p){p=strpbrk(s,"^<?!");c=*p-60;*p++=0;!c?[s](auto&p){char*e=p,c=0;for(;*e-62|c;e++)c+=*e-62?*e==60:-1;for(*e++=0;V[s];r(strdup(p)))V[s]--;p=e;}(p),0:c+27?c-3?c-34||V[s]++:scanf("%llu",&V[s]):printf("%llu",V[s]);}}

Try it online!

@ceilingcat  You're right - I'll go back and add TIO links to all my other answers...

JavaScript (ES6) 184 194 209
Edit Simplified (using function parameters for input and output seemed a nice idea, but it was not), 1 more byte saved thx @ӍѲꝆΛҐӍΛПҒЦꝆ
Edit 2 Modified parsing. The logic for increment/input is borrowed from @Lynn's answer
F=(p,i=0,v={},n='')=>eval("for(;c='>?^!<'.indexOf(q=p[i++]||'');n=~c?'':n+q)if(c>3){for(;v[n]--;)F(p,i,v);i=F(p,i,v[n]=0)}else~c&&v?c>2?alert(v[n]|0):v[n]=~~v[n]+(--c||+prompt()):0;i")

Less golfed
F=(p,      // program
   i = 0,  // initial instruction pointer
   v = {}, // variables (default to empty) or if 0, flag of dummy execution
   n = ''    // name of current variable (has to be local for recursive calls)
{
  for(; c='>?^!<'.indexOf(q=p[i++]||''); )
  // q = current character
  // c = current command (int 0..4 or -1 id not recognized)
  //     note 0 end of subprogram or end of program
  {
    if(c>3) // 4='<' call subprogram - recursive
    {
      for(;v[n]--;)
        F(p,i,v); // conditional call, repeated - using real environment
      v[n] = 0; // Reset variable at loop end
      i=F(p,i,0) // one more unconditional dummy call, just to advance i
    }
    else
      ~c&&v? // if valid command (1..3) and not dummy
      c>2?
        alert(v[n]|0) // output, undefined becomes 0
        :v[n]=~~v[n]+(--c||+prompt()) // inc with 1 or user input
      :0     // not valid command or dummy, do nothing
    n=~c?'':n+q // reset or update current variable name
  }
  return i // return current istruction pointer (for recursive calls)
}

TEST The snippet start evaluating 2016 using the program posted by @Neil. Be patient...

F=(p,i=0,v={},n='')=>eval("for(;c='>?^!<'.indexOf(q=p[i++]||'');n=~c?'':n+q)if(c>3){for(;v[n]--;)F(p,i,v);i=F(p,i,v[n]=0)}else~c&&v?c>2?alert(v[n]|0):v[n]=~~v[n]+(--c||+prompt()):0;i")

// TEST
function definput(){  I.disabled = KI.checked; }
function defoutput(){  O.disabled = KO.checked; }

function run()
{
  var prog=P.value, irows = I.value.split('\n'), pi=0;
  var fout=x=>O.value+=x+'\n';
  var fin=x=>irows[pi++];
  var saveAlert=alert, savePrompt=prompt
  if (!KO.checked) alert=fout,O.value=''
  if (!KI.checked) prompt=fin

  F(prog);

  alert=saveAlert
  prompt=savePrompt
}

P.value="^^^^a<^^^^>a<cb<c^^>>!"

run()
Program <button onclick="run()">RUN</button>

<textarea id=P></textarea>

Input (or <input type=checkbox id=KI onclick="definput()"> interactive prompt)

<textarea id=I>5</textarea>

Output (or <input type=checkbox id=KO onclick="defoutput()"> popup)

<textarea id=O readonly></textarea>

Is using eval to avoid return not an option?

@ӍѲꝆΛҐӍΛПҒЦꝆ yes, eval saves 1 byte. I'm still looking for something more substantial

Perl, 251 bytes
@p=split/([<>!?^])/,<>;for$c(0..$#p){$_=$p[$c];/</&&push@j,$c;if(/>/){$a=pop@j;$p[$c]=">$a";$p[$a]="<$c";}}while($c<$#p){$_=$p[$c];/\^/&&$v{$l}++;/!/&&print$v{$l};/\?/&&($v{$l}=<>);/<(\d+)/&&($v{$l}?$v{$l}--:($c=$1));/>(\d+)/&&($c=$1-2);$l=$_;$c++;}

Easier to read version:
# treat the first line of input as a program

# split on punctuation keywords; @p will contain the program as a list
# of tokens (including whitespace between adjacent punctuation)
@p = split /([<>!?^])/, <>;

# rewrite jump addresses

# the interpreter could scan backwards to avoid this, but that idea
# makes me feel dirty
for $c (0..$#p) {
    $_ = $p[$c];
    # save loop-start address on stack
    /</ && push @j, $c;
    if (/>/) {
        # if we encounter a loop-end instruction, rewrite it and the
        # corresponding loop-start to include the address (of the
        # instruction---jumps have to offset from this)
        $a = pop @j;
        $p[$c] = ">$a";
        $p[$a] = "<$c";
    }
}

# execute the program

# our program is already in @p

# $c will contain our program counter

# $l will contain the name of the last-referenced variable

while ($c < $#p) {
    # move current instruction into $_ for shorter matching
    $_ = $p[$c];

    # increment instruction
    /\^/ && $v{$l}++;

    # output instruction
    /!/ && print $v{$l};

    # input instruction
    /\?/ && ($v{$l} = <>);

    # loop start, including address
    /<(\d+)/ && ($v{$l} ? $v{$l}-- : ($c = $1));

    # loop end, including address
    />(\d+)/ && ($c = $1-2);

    # copy current instruction into "last variable name"---this will
    # sometimes contain operators, but we have null-string
    # instructions between adjacent operators, so it'll be fine
    $l = $_;

    # advance the program counter
    $c++;
}

This wastes a bunch of bytes fixing up loops to be direct jumps, but scanning backwards for the loop start offended my sense of aesthetics.


text:
Write a radix sort
Goal
As the title suggests, write a radix sort function (either MSB or LSB is fine) that accepts two parameters:

an array of values of any type (you can assume that they are all of the same type / class, etc.)
a function (or function pointer, depending on your language) that takes a single parameter of the same type as the objects given in the array and returns the coerced integer key of the object.

Implementation may mutate the array or operate out-of-place, but must return the sorted array.
Tips

If array indexing in your language is affected by the byte-size of each index, you can assume that the objects referenced in the array are pointers rather than values.
If the size of an array pointed to in a function parameter cannot be determined in your language, then add another parameter to your radix sort signature, passing the size in bytes of your array, or number of elements in your array, whichever you prefer:

void *rsort(void *arr, size_t length, int(*key)(const void *));

Bonus
A bonus reduction of 20% to your score will be given if your implementation memoizes the keys of the objects in the array so that the function provided only needs to be called once for each object in the array.
Example Usage (and test-case)
Assuming an answer was provided in JavaScript, a test-case might look something like this:

/* note that this implementation will not be acceptable as a submission -
 * it is NOT a true radix sort
 */
function myFakeRadixSort(array, key) {
  return array.sort(function(a, b) {
    return key(a) - key(b);
  });
}

/* this will be used as an example key function -
 * you will not need to implement this
 */
function complexity(obj) {
  return JSON.stringify(obj).length;
}

var tree = {
  a: {
    b: {
      c: "a string",
      d: 12
    },
    e: ["an", "array"]
  },
  f: true,
  g: {
    h: null,
    i: {},
    j: {
      k: 500
    }
  }
};

/* another example key function
 */
function index(obj) {
  return JSON.stringify(tree).indexOf(JSON.stringify(obj));
}

var data = [];

/* this is a hack to traverse the object */
JSON.stringify(tree, function(key, value) {
  data.push(value);
  return value;
});

document.write(`<h2>Sorted by "complexity"</h2>`);
document.write(`<pre>${myFakeRadixSort(data, complexity).map(o=>JSON.stringify(o)).join`\n`}</pre>`);
document.write(`<h2>Sorted by "index"</h2>`);
document.write(`<pre>${myFakeRadixSort(data, index).map(o=>JSON.stringify(o)).join`\n`}</pre>`);

tl;dr
Write a radix sort with this signature, or as close as possible to this signature:
void *rsort(void *arr, int(*key)(const void *));

Leaderboards

var QUESTION_ID=71693,OVERRIDE_USER=42091;function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"https://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="
"+e.body.replace(OVERRIDE_REG,"")+"
")});var a=r.match(SCORE_REG);a&&e.push({user:getAuthorName(s),size:+a[2],language:a[1],link:s.share_link})}),e.sort(function(e,s){var r=e.size,a=s.size;return r-a});var s={},r=1,a=null,n=1;e.forEach(function(e){e.size!=a&&(n=r),a=e.size,++r;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",n+".").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SIZE}}",e.size).replace("{{LINK}}",e.link),t=jQuery(t),jQuery("#answers").append(t);var o=e.language;/s.lang?1:e.lang<s.lang?-1:0});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{LANGUAGE}}",o.lang).replace("{{NAME}}",o.user).replace("{{SIZE}}",o.size).replace("{{LINK}}",o.link),i=jQuery(i),jQuery("#languages").append(i)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<h\d>\s*([^\n,]*[^\s,]),.*?(\d+|\d*\.\d+|\d+\.\d*)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;
body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}
 <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

{{PLACE}}	{{NAME}}	{{LANGUAGE}}	{{SIZE}}	Link

{{LANGUAGE}}	{{NAME}}	{{SIZE}}	Link

Here is a Stack Snippet to generate both a regular leaderboard and an overview of winners by language.
To make sure that your answer shows up, please start your answer with a headline, using the following Markdown template:
# Language Name, N bytes

where N is the size of your submission. If you improve your score, you can keep old scores in the headline, by striking them through. For instance:
# Ruby, <s>104</s> <s>101</s> 96 bytes

If there you want to include multiple numbers in your header (e.g. because your score is the sum of two files or you want to list interpreter flag penalties separately), make sure that the actual score is the last number in the header:
# Perl, 43 + 2 (-p flag) = 45 bytes

You can also make the language name a link which will then show up in the leaderboard snippet:
# [><>](http://esolangs.org/wiki/Fish), 121 bytes

Shortest code in bytes wins!

Is a decimal radix sort okay, or does it need to be binary?

Bonuses in code golf are generally discouraged. I recommend you either remove the bonus entirely or make it part of the requirement.

@ThomasKwa any radix you choose will be acceptable, just make sure to specify that when you explain your implementation in your answer.

Is there an upper bound on the keys? Will they always be positive?

@ThomasKwa, the keys can be assumed to be non-negative. 0 is a possible key, and the upper bound will be whatever your language's default integer maximum is.

@Mego Bonuses are only interesting when they pose a trade-off that could go either way. I chose 20%, as that seemed like a fairly reasonable trade-off that would allow viable answers with or without the bonus.

What builtins are allowed? Pyth has .g, which groups values in an array by the output of some function.

@ThomasKwa This may sound hard to interpret, but any language builtins and standard libraries are fine, as long as you implement the radix sort. For example, if you use .g in your implementation to group values by one digit at a time, I would accept that. If you use some builtin to just sort the array for you (like in my example code), that would not be acceptable.

@PatrickRoberts When the bonuses are well-balanced, you can have the opposite problem that a golfer needs to write a bunch of different variants of the program to see what's worth in, which becomes exponentially more cumbersome with more and more bonuses.. Having to solve the problem twice to determine the best score is annoying and detracts from the challenge.

@Mego That sounds like a personal opinion, and I personally disagree. I provided that bonus with the intention of getting a little more variation in the supplied answers. Besides, it's only one bonus, which nullifies your "exponentially more cumbersome" argument. There's only two variations per hypothetical answer, and that's easy enough to test. I'd even go as far as to say it makes the challenge more interesting.

@PatrickRoberts It's the personal opinion of at least 27 users of the site (given the score of +26/-0 on the meta post). Bonuses typically detract from the core challenge. This is not an exception.

@Mego there are many other users that did not care to vote (maybe a silent majority). Now there is at least 1 vote against that topic anyway

Pyth, 6 bytes - 20% = 4.8
s.gykQ

This uses radix sort with base 2^64. Since all keys will be non-long positive integers, they are one digit long in base 2^64. We use .g to bucket the numbers, and s to flatten the resulting array. Calls to y are implicitly memoized.
Define the function y with L, which is a lambda b. For example:
Lab5        ## y = lambda b: abs(b-5)
s.gykQ

Less cheaty is this decimal LSB radix sort at 15 bytes - 20% = 12:
us.ge/yk^THGyTQ

Which takes the last twenty decimal digits, plenty for 64-bit numbers.
Try it here.

Also could you add an example usage and at least two test cases to demonstrate that it is type-agnostic?

@PatrickRoberts Done.

Haskell, 111 89 bytes * 0.8 = 71.2
f%a=fst<$>iterate(\x->(even#x)++(odd#x))[(x,f x)|x<-a]!!64
f#x=[(i,j`div`2)|(i,j)<-x,f j]

Usage example (sort on the sum of the lists): sum % [[1,2,3,4], [2,3,4,5], [1], [1,4,8], [9], [0]] -> [[0],[1],[9],[1,2,3,4],[1,4,8],[2,3,4,5]].
Assuming the given functions maps to non-negative 64-bit integers.
This implements binary radix sort.
How it works:
           [(x,f x)|x<-a]    -- map each element x of the input list to a pair
                             -- (x,f x), so the given function f is used only once
   iterate (...) (...) !! 64 -- repeatedly apply one step of the radix sort and
                             -- take the 64th iteration
fst<$>                       -- remove the second element of the pair, i.e.
                             -- restore the original element

                             -- one step of the radix sort
\x->(even#x)++(odd#x)        -- partition the list in pairs with even and
                             -- odd second elements and divide the second
                             -- element of the pairs by 2. Re-concatenate

[(i,j`div`2)|(i,j)<-x,f j]   -- helper function: filter pairs where the second
                             -- element j satisfy predicate f. Adjust j.

Further calling examples:
length % ["Hello","World!","Golf"]
         -> ["Golf","Hello","World!"]

(fromEnum.last) % ["Strings","sorted","on","last","character"]
         -> ["sorted","on","character","Strings","last"]

maximum % [[1,2,3,4], [2,5,4], [5,5], [4], [6,2], [2,3]]
         -> [[2,3],[1,2,3,4],[4],[2,5,4],[5,5],[6,2]]

is this function type-agnostic? Could I supply an array of strings, or an array of some arbitrary type?

@PatrickRoberts: yes it is. I've added another example.

ES6, 113 bytes - 20% = 90.4
(a,g)=>(s=(a,i)=>i?s(a.filter(x=>~x[1]&i).concat(a.filter(x=>x[1]&i)),i<<1):a)(a.map(x=>[x,g(x)]),1).map(x=>x[0])

Uses 2 as the radix. Ungolfed:
function rsort(array, key) {
    array = array.map(value => [value, key(value)]);
    // bit becomes zero when the bit falls off the left end
    for (bit = 1; bit; bit <<= 1) {
        zero = array.filter(pair => !(pair[1] & bit));
        one = array.filter(pair => pair[1] & bit);
        array = zero.concat(one);
    }
    return array.map(value => value[0]);
}

Test cases:

f=(a,g)=>(s=(a,i)=>i?s(a.filter(x=>~x[1]&i).concat(a.filter(x=>x[1]&i)),i<<1):a)(a.map(x=>[x,g(x)]),1).map(x=>x[0]);

/* example key function */
function complexity(obj) {
  return JSON.stringify(obj).length;
}

var tree = {
  a: {
    b: {
      c: "a string",
      d: 12
    },
    e: ["an", "array"]
  },
  f: true,
  g: {
    h: null,
    i: {},
    j: {
      k: 500
    }
  }
};

/* another example key function
 */
function index(obj) {
  return JSON.stringify(tree).indexOf(JSON.stringify(obj));
}

var data = [];

/* this is a hack to traverse the object */
JSON.stringify(tree, function(key, value) {
  data.push(value);
  return value;
});

document.write(`<h2>Sorted by "complexity"</h2>`);
document.write(`<pre>${f(data, complexity).map(o=>JSON.stringify(o)).join`\n`}</pre>`);
document.write(`<h2>Sorted by "index"</h2>`);
document.write(`<pre>${f(data, index).map(o=>JSON.stringify(o)).join`\n`}</pre>`);

There seems to be an issue with your algorithm. I ran your function on my complexity key with the data array from my example, and the output didn't seem to have any distinguishable order (but it is consistently this output): ["{"b":{"c":"a string","d":12},"e":["an","array"]}", ""an"", "true", "null", ""a string"", "12", "["an","array"]", "{}", "{"a":{"b":{"c":"a string","d":12},"e":["an","array"]},"f":true,"g":{"h":null,"i":{},"j":{"k":500}}}", "{"c":"a string","d":12}", ""array"", "{"h":null,"i":{},"j":{"k":500}}", "{"k":500}", "500"]

Fixed, and conveniently saved me 4 (3.2) bytes too!

Yep, it checks out. Nice job! If you can, please add my two test-cases in a code snippet to your answer. If you're not sure how to, just tell me to edit your answer and I will.

I'm not terribly familiar with JS code snippets (so far I've only used them for HTML/CSS stuff) so feel free to go ahead.

I added the test cases for you.