294

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 ...


71

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"), ...


63

Python, 100%, 225 bytes import requests 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 ...


59

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 ...


38

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,...


29

Retina, 50 bytes, 71.8% 72.15% ^.*([[CE;ಠ-ﭏ]|tar|ol|l.x|eo|a.u|pin|nu|o.f|"$) 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 ...


27

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... #include <bits/stdc++.h> #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> ...


25

C++11 Further small update: Do much less adding, and try all numbers of form A*B+C. I believe that, within the time limit, this is fairly close to optimal, assuming you only use +, * and !. I leave other operators to people with more time than me! Small update: Try harder to make use of factorials and numbers like 11....111. Also fixed bug that I wasn't ...


21

Perl 28 / 13 ≈ 2.15 sub r{$s^=~($s^=$s/7215)<<8} log file here Perl 29 / 13 ≈ 2.23 sub r{$s^=~($s^=$s<<8)/60757} log file here These are something of a variation on a Xorshift, using floating point division instead of a right shift. They both pass 13 of 15 tests, failing only tests 6 and 7. I'm not exactly sure how long the ...


18

JavaScript ES6, 50 bytes, 71.10% Correctly identifies 670 starred and 752 non-starred. x=>/ .[DERv]|tar|a.u|l.x|<i|eo|ol|[C;ಠ]/.test(x) 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 ...


17

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 ...


17

Python 3 + scikit-image Simply sets the color of the missing channel to the average of the other two. import sys from skimage import io, color im = io.imread(sys.argv[1]) h, w, c = im.shape removed_channel_options = {0, 1, 2} for y in range(h): for x in range(w): if len(removed_channel_options) == 1: break removed_channel_options -= {...


17

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 ...


16

Bash, 100%, 100 bytes sed sX..s.2./s.XX|grep -Po '(?<=>)[^<]+?(?=(,(?! W)| [-&–5]| ?<| [0-79]\d| ?\((?!E|1\.)))'|head -1 Try it online on Ideone. Verification $ wget -q https://gist.githubusercontent.com/vihanb/1d99599b50c82d4a6d7f/raw/cd8225de96e9920db93613198b012749f9763e3c/testcases $ grep -Po '(?<= - ).*' < testcases > input $...


16

PHP (>=7), 100% (40/40) <?php set_time_limit(0); class BlackHat { const ROTATION_RANGE = 45; private $image; private $currentImage; private $currentImageWidth; private $currentImageHeight; public function __construct($path) { $this->image = imagecreatefrompng($path); } public function hasBlackHat() {...


15

C# - 2,098,382 steps I try many things, most of them fail and just didn't work at all, until recently. I got something interesting enough to post an answer. There is certainly ways to improve this further more. I think going under the 2M steps might be possible. It took approx 7 hours to generate results. Here is a txt file with all solutions, in case ...


15

Pyth, 50 bytes, 67.9 % 0000000: 21 40 6a 43 22 03 91 5d d3 c3 84 d5 5c df 46 69 b5 9d !@jC"..]....\.Fi.. 0000012: 42 9a 75 fa 74 71 d9 c1 79 1d e7 5d fc 25 24 63 f8 bd B.u.tq..y..].%$c.. 0000024: 1d 53 45 14 d7 d3 31 66 5f e8 22 32 43 7a .SE...1f_."2Cz This hashes the input in one of 322 buckets and chooses the Boolean depending on that ...


14

CJam, 45 bytes, 65.55% l_c"\"#&'(-.19<CEFHIJLMOPSTXY[_qಠ"e=\1b8672>| This checks if the first character is in a specific list or the sum of all code points is larger than 8,672. Scoring $ cat startest.cjam 1e3{l_c"\"#&'(-.19<CEFHIJLMOPSTXY[_qಠ"e=\1b8672>|}* $ java -jar cjam-0.6.5.jar startest.cjam < starred.txt | fold -1 | sort | ...


14

Compressor (Ruby), score 1502/1656 ≈ 90.7% require 'zlib' input = $*[0].to_s.chomp recent_input = input[-35..-1] || input puts recent_input.chars.uniq.min_by { |char| [Zlib::Deflate.deflate(input+char,9).size,-input.count(char),-input[-10..-1].to_s.count(char)] } || ?y Checks whether the current string would be more compressible if 'y' or 'n' were added to ...


14

Polyglot, ~18.6% This works in: Cjam, Pyth, TeaScript, Japt, Seriously, 05AB1E, GolfScript, Jelly, and probably many more. 6 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 ¯\_(ツ)_/¯


13

JavaScript (ES6), 43 bytes, 622 630 633 Just to get the ball rolling. Returns 1 for nouns, 0 for non-nouns. s=>2552>>s.length&/^[bcdf-mp-tvwy]/.test(s) How? We bet on noun if both following conditions are met: The word length is 3, 4, 5, 6, 7, 8 or 11. This is done by right-shifting the binary number 100111111000 (2552 as decimal). The word ...


13

Brain-Flak, 130 bytes {({}<>)<>}<>{((((()()()()()){}){}){}<>)<>{(((((()()()()()){}){}){}<>)())<>({}[()])}<>((((()()()()()){}){}){}())<>{}}<>{({}<>)<>}<> Try it online! Output for <your brain-flak code here>: 5045 bytes (()()()()()()()()()()()()()()()()()()()()()()()()()()(...


12

Python 2, Score = 68 89 This solution uses the hash of the flag image file to create an index into a list of the country abbreviations. If more than one flag hashed to an index, only the first abbreviation will be returned (so it will fail some of those tests with more than one country in a hash bucket). This algorithm does however guarantee one correct ...


11

Retina 0.8.2, 100%, 75 71 70 68 67 64 59 53 51 bytes <.*?> (,| [-&(–5]| [0-7]\d)(?! W|...\)).* 2 |: This is essentially code golf now, so I had to switch languages. Try it online! Verification $ wget -q https://gist.githubusercontent.com/vihanb/1d99599b50c82d4a6d7f/raw/cd8225de96e9920db93613198b012749f9763e3c/testcases $ grep -Po '(?<= - ).*' ...


11

CJam, 139 141 There's a lot of unprintables in the code, so here's the xxd hexdump: 00000000: 7132 3925 3162 226d cec5 9635 b14b 69ee q29%1b"m...5.Ki. 00000010: d9d0 66e8 97b8 e88d 2366 7857 9595 1c73 ..f.....#fxW...s 00000020: 9324 11b2 ddb8 7a3f 19ed bd37 07c0 cb86 .$....z?...7.... 00000030: 394e b34a ecf0 8c9b f300 a216 2e2e 594a 9N.J..........YJ ...


11

Jelly, 48 bytes, score 731 This is my first ever answer in Jelly and I went to a lot of trouble putting this together. Ah well ... that was fun. :-) O‘ḅ⁹%⁽€Oæ»4“Ạ$ⱮẊḲḲLÑMṆụ⁻ẉṂ`ŻvḤæɠ5ṭȯƁU*×TdƲḥ`’æ»Ḃ 1 byte saved thanks to @JonathanAllan Try it online! Breakdown and test suites Non-nouns correctly identified as non-nouns: 265 / 414 (64%) Nouns correctly ...


10

Python – 10,800,000 steps As a last-place reference solution, consider this sequence: print "123456" * 18 Cycling through all the colours n times means that every square n steps away will be guaranteed to be of the same colour as the center square. Every square is at most 18 steps away from the center, so 18 cycles will guarantee all the squares ...


10

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 ...


10

Jelly, 50 bytes, score 763 Using a hash now (much like Arnauld's Jelly answer) OP%⁽Wpị“!ḋGẠ⁻Ṭȥʋt|Ḥ\⁾°½İ@G2ḂƑ½ịʂ¶ɦḲ⁷³Hz~⁵p9)⁹ƙ¿’B¤ Try It Online! 250 / 414 for Non-Nouns 513 / 586 for Nouns Total = 250 + 513 = 763. How? Builds a table with 308 entries, either 1 (identifying a noun) or 0 (identifying a non noun) and indexes into it using a key provided ...


10

JavaScript (ES6), 50 bytes, score 693 s=>!/^([aouz]|th|..$)|e.+[ey]|[flo].r|a.p/.test(s) Just looking for any possible patterns that non-nouns have that nouns don't. Non-nouns more often contain: a, o, u, or z as the first letter. th as the first two letters. Two letters only. [Think pronouns (me, we, us, he, it) and prepositions (of, to, in, on, by, ...


Only top voted, non community-wiki answers of a minimum length are eligible