# Tag Info

300

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

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

64

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

62

Ruby, 29 bytes ->s{!s[/[^aeiou]{3}|[jqxz]/]} 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: ...

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

37

Python 2, 99 73 65 64 63 bytes lambda s:'PVC'*('ea'in s)or'wtoiondnyy'[s[-2:]in'instperit'::2] Try it online! Alternatives also with 63 bytes: lambda s:'PVC'*('ea'in s)or'wtoiondnyy'[s[-6::5]in'dtenmsr'::2] lambda s:'PVC'*('ea'in s)or'wtoiondnyy'[s[::5]in'lrinaosit'::2]

28

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> ... 24 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. "un"'el2b"zPB: ":i+:%2/* Due to the unprintable characters, I'm sure Stack Exchange swallows some, so you might want to copy the code from the character ... 23 1. Retina, 0 bytes Try it online! The empty program prints 1 when given empty input (i.e. itself), because it counts how often the empty regex matches the input (which is always 1+length(input)). 22 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. f=->s{s[/la|tt|i.e|[égdzœu]..$|^b|^f|so|^ta/]?'une':'un'} 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 ...

20

Pyth, 22 20 bytes ql{m+=Z*=T^.j)hCdzlz 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 ...

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

18

Jelly, 7 5 bytes ƈƈeØA Lossy formats return 0, lossless formats return 1. Try it online! (permalinks in Gist) Background The formats we have to support have the following magic numbers, i.e., they start with these bytes. Format Header (text) Header (hex) ----------------------------------------------------------------------------------- AC3 ...

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

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

17

MATL, 20 bytes U|sG36ZA13\[BID1]m+g 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] m ...

17

Python 2, 62 bytes lambda n:'wtPoiVonCdn yy'[hash(n)%97%78%28%15%2+('ea'in n)::3] Try it online! How? 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 ...

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 ... 15 Jelly, 23 bytes ^Ḋṫ4^^æ«11$æ»31ż&2\ḂS<4 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.) Background 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 ...

15

Python 2, 36 bytes lambda n:'5521'[n%~9/-3>>n/10%~9/-9] 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. lambda n:'5521'[n%~9/-3] 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] But, ...

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

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 ¯\_(ツ)_/¯

14

Python 2, 405 335 234 182 171 bytes lambda s,j=''.join:j(' QPVXU_O__FBLK_JMD_CSYZWIENH_AG___TR'[int(j(ord(y)%2for 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

13

Groovy, 77 74 x={it==~/^(?!.+[jq]|[^aeiou][^aeiouhlr]|.[^aeiouy]{3}|.[x-z])|^s[cknptw]/} 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 ...

13

CJam, 0 errors (36 32 29 28 bytes) {"un"oEb72^"+ÕåWïº"583b2b='e*o}:F; 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 " ...

13

Jelly,  50 44  42 bytes ỴZ;6/UOḂḅ7‘ị“¥ŒƲVĊ⁾|W£⁼³ƭÇuʋụzḢĖ0ḢẆẠØsĠỌỊ» 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). How? Splits on new lines, transposes, ...

12

JavaScript (ES6), 105 102 101 bytes c=>/[~`0-9!@#-&^(-+_=-]/.test(c)+/[asdfghjkl;:'"\n]/i.test(c)*3+/[zxcvbnm,<.>/?]/i.test(c)*4||++c*7^2 Explanation In JavaScript test returns a boolean which acts the same as 1 or 0 so I multiply them by their row. Testing for row 2 took the most bytes so I used that one as the default if no others matched. ...

12

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

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