Mathematica, 100%, 141 bytes
Well, this feels more than a little like cheating. It's also incredibly slow as well as being very silly. Function f sees roughly ...
Python, 100%, 225 bytes
SEARCH = "http://www.bing.com/images/searchbyimage?FORM=IRSBIQ&cbir=sbi&imgurl="
THRESHOLD = 30
url = raw_input()
print "Upgoat" if requests.get(SEARCH + url).content.count('img') > THRESHOLD else "Downgoat"
Use reverse image search on the goat. If the page returns a satisfiable amount of results, it is ...
Ruby, 29 bytes
Hopefully I've got this right - it's my first time programming in Ruby. I actually did all my testing in Python, but import re was far too long for me.
This is an anonymous function which takes in a string and outputs true/false accordingly. It uses a regex which looks for one of the following two things:
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 ...
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
Retina, 50 bytes, 71.8% 72.15%
Tried some regex golfing at @MartinBüttner's suggestion. This matches 704 starred messages and doesn't match 739 unstarred messages.
The ^.*( ... ) is to make sure that there is always either 0 or 1 match, since Retina outputs the number of matches by default. You can score the ...
C++11 (gcc; 1639 1625 1635 bytes, Class 1, score=983, 960)
Let's get it started. It's probably the longest code I've ever shortened...
#define $ complex<double>
#define C vector<$>
#define I int
#define D double
#define P pair<D,I>
#define Q pair<D,D>
#define E vector<D>
#define V vector<P>
CJam, 0 incorrect, 32 29 bytes
This code uses a few odd characters (some of them unprintable), but they are all well within extended ASCII range. So again, I'm counting each character as a single byte.
Due to the unprintable characters, I'm sure Stack Exchange swallows some, so you might want to copy the code from the character ...
Ruby, 0 incorrect, 63 56 53 52 51 50 bytes
All characters are in extended ASCII, specifically ISO 8859-1, so I'm counting each character as a single byte.
It looks like your test set was a bit too short. I've generated the regex with Peter Norvig's meta regex golfer.
You can call the above ...
Pyth, 22 20 bytes
Try it yourself or run the testsuite.
Note the ASCII values of SRL, respectively 83, 76, 82. I abuse the fact that:
i 83 + 1 = 1
i 76 + 1 = i
i 82 + 1 = -i
From here I just keep a variable for the current position and current direction. For every character I multiply the current direction with the above ...
Correctly identifies 670 starred and 752 non-starred.
Now across the 70% barrier, and beating everyone except Retina!
Returns true if the message contains any of these things:
A word of which the second letter is D, E, R, or v;
tar (usually star);
a and u with one char ...
Jelly, 7 5 bytes
Lossy formats return 0, lossless formats return 1.
Try it online! (permalinks in Gist)
The formats we have to support have the following magic numbers, i.e., they start with these bytes.
Format Header (text) Header (hex)
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 ...
C, 297 bytes, 43.194351% matched (v2)
This is the first non-golf challenge I've competed in. Surprisingly, golfing languages are actually rather easy to separate, with about 60% matching accuracy per language.
The code requires input as UTF-8 string, results based on version 2 of the supplied dataset. This code does not require <LF> to be replaced with ...
MATL, 20 bytes
Input is a string enclosed in single quotes. Output is 1 for truthy or 0 for falsy.
Try it online! Or verify all test cases.
How it works
U|s % Take input implicitly. Interpret as number, absolute value, sum
G36ZA % Push input again. Convert from base-36
13\ % Modulo 13
[BID1] % Push array [6 3 8 1]
Python 2, 62 bytes
lambda n:'wtPoiVonCdn yy'[hash(n)%97%78%28%15%2+('ea'in n)::3]
Try it online!
This submission uses the fact that the hash function is stable for strings in Python 2. Each valid input has a valid output. The brute-forced repeated modulo %97%78%28%15%2 returns 1 for all tinny and PVC words and 0 for woody words. By adding the value ...
Jelly, 23 bytes
Takes an array of integers; returns [0, 1] for LCG, [1, 0] for Xorshift, and [0, 0] for MT.
Try it online! (The permalink might be too long for some browsers.)
The most random thing about the LCG is that it is considered a PRNG. For starters, the lower k bits of the state aren't affected by the ...
Python 2, 36 bytes
Try it online!
Same length arithmetically:
lambda n:5/(n%~9/-3>>n/10%~9/-9or 1)
Let's first look at simpler code that doesn't account for teens.
Here, we want a mapping of the one's digit to an output that works like
[5, 1, 2, 2, 2, 5, 5, 5, 5, 5][n%10]
CJam, 45 bytes, 65.55%
This checks if the first character is in a specific list or the sum of all code points is larger than 8,672.
$ cat startest.cjam
$ java -jar cjam-0.6.5.jar startest.cjam < starred.txt | fold -1 | sort | ...
This works in: Cjam, Pyth, TeaScript, Japt, Seriously, 05AB1E, GolfScript, Jelly, and probably many more.
This outputs Hillary for all inputs. This is because Hillary said the most. While it's not the most
ingenious way to do this. It works ¯\_(ツ)_/¯
Python 2, 405 335 234 182 171 bytes
lambda s,j=''.join:j(' QPVXU_O__FBLK_JMD_CSYZWIENH_AG___TR'[int(j(`ord(y)%2`for y in j(s.split('\n')[x][i:i+5]for x in range(5))),2)%13836%37]for i in range(0,len(s)/5,6))
Try it online!
Finally shorter than JS
Groovy, 77 74
I wrote the test program in Java, which you can find in this Gist on Github. Here is the output from my test program:
Good: 2135 1708
Bad: 101 528
(Failed 629 test cases)
P.S. I think this is going to end up a regex golf problem extremely soon...
If Sp3000's answer ...
CJam, 0 errors (36 32 29 28 bytes)
This is a named function, so I'm only counting the inner code. Also, o is a print statement, so it doesn't contribute to the byte count.
Try the test cases in the CJam interpreter.
How it works
"un"o " Print 'un'. ";
Eb " ...
Jelly, 50 44 42 bytes
Try it online! (note the argument does not require the leading newline, but since leading and trailing newlines have no effect I included one to make the multiline string more human-readable)
Results are mixed case (as allowed by the OP in a comment).
Splits on new lines, transposes, ...
2. Brain-Flak, 22 bytes
Try it online!
This checks the top of the stack and puts a one on the opposite stack if it is non-zero. It then increments and returns the opposite stack. This makes it return 1 for the empty program and 2 for anything else.
Since stacks in Brain-Flak default to zero, an empty program will ...