48 votes

Help, I'm trapped in a Sierpinski triangle!

Python 2, 208 205 200 bytes ...
user avatar
  • 7,557
44 votes
Accepted

Should we be friends?

SWI-Prolog, 62 47 41 bytes X*Y:-X+Y;Y+X;X==Y. X?Y:-not(X*Y),X*Z,Y*Z. Prolog isn't too often useful, but when it is it's just beautiful. We'll use ...
user avatar
  • 38.6k
29 votes

40 Numbers in 9 Bytes

Deadfish, 18 This was actually the first language I tried before I considered infix operators. I'm posting it now for the sheer hilarity of the idea that Deadfish could be useful for something. <...
user avatar
  • 60.9k
27 votes

Where should I put my restaurant?

C, 315 302 bytes ...
user avatar
  • 5,342
27 votes
Accepted

40 Numbers in 9 Bytes

PARI/GP - 24 1%1 8 2+3 PARI/GP ignores spaces between digits, so that 1 8 2, for example is treated as ...
user avatar
  • 32.6k
25 votes

40 Numbers in 9 Bytes

Python REPL and many more, 22 23 6+7 *5% 6%4 Key observation: If you colour the grid like a checkerboard, the path alternates grid colours as it goes and starts ...
user avatar
  • 60.9k
23 votes

Get to the Zone!

JavaScript (ES6), 30 bytes Takes input as (N)(M). N=>g=M=>M>N?M%2-~g(M+1>>1):N-M Try it online! How? Instead of ...
user avatar
  • 165k
21 votes

Infinite Labyrinths

C# - 423 375 bytes Complete C# program, accepts input via STDIN, outputs "True" or "False" to STDOUT as appropriate. I could not bare to leave that Linq in there... thankfully its removal paid off! ...
user avatar
  • 3,858
20 votes

Is it bipartite?

Wolfram Language (Mathematica), 26 25 bytes Tr[#//.x_:>#.#.Clip@x]<1& Try it online! How it works Given an adjacency matrix A, we find the fixed ...
user avatar
  • 5,177
18 votes
Accepted

Create xkcd-Style Narrative Charts

Python3 with numpy, scipy and matplotlib edit: I tried to keep the groups in the same relative position between events, hence the sorted_event function. New ...
user avatar
  • 850
18 votes

Can my 4-note music box play that song?

CJam, 34 31 bytes 8,q{~2*f{_@-_zF8b&,@@+8,=*}0-}/ Did this on my phone, so I'll have to put up an explanation later. Output is nonempty iff truthy. Try it ...
user avatar
  • 60.9k
18 votes
Accepted

Follow incomplete directions

Perl, 150 149 146 145 141 140 138 136 135 133 130 126 125 124 Added +7 for -F -Xn0i An initial attempt. Run with the map on STDIN and the directions after the -i option, e.g. ...
user avatar
  • 14.6k
17 votes
Accepted

Your car only turns right!

JavaScript (ES6) - 122 124 148 162 172 178 187 190 193 208 bytes Many thanks to Optimizer and DocMax for helpful suggestions on how to improve this code: ...
user avatar
16 votes

Somewhere On The Tube ...But On Which Lines?

ES6, Node.js / Chrome, 989 977 931 892 889 887 bytes ...
user avatar
  • 165k
16 votes
Accepted

Somewhere On The Tube ...But On Which Lines?

Mathematica 8+, 266 bytes ...
user avatar
  • 466
15 votes

Arranging Bubbles

Python 2, 92 87 bytes a=lambda n:n<2or sum((k%d<1)*d*a(d)*a(n-k)for k in range(1,n)for d in range(1,1+k))/~-n In plain english: to compute ...
user avatar
  • 38.6k
15 votes

Should we be friends?

PHP, 138 133 129 bytes PHP beats Mathematica - a rare occurence. ...
user avatar
  • 14.4k
15 votes

Hexcellent Minesweeping

7 5 vertices, 14 10 edges (Graph made with this online tool and paint.) A-F are our six nodes, and ...
user avatar
  • 25k
15 votes

Is this Game of Go configuration fully alive?

JavaScript, 178 bytes ...
user avatar
  • 28.6k
14 votes
Accepted

Is My Graph Planar?

Mathematica, 201 bytes ...
user avatar
14 votes

Two-Coloring Overlapping Circles

Mathematica, 165 bytes ...
user avatar
  • 14.9k
14 votes

Are these states connected?

Wolfram Language (Mathematica), 169 167 bytes ...
user avatar
  • 14.9k
13 votes

Where should I put my restaurant?

TI-BASIC, 20 fMin(sum(abs(iX-Ans)),X,~E99,E99 Takes input on the homescreen of your TI-83 or 84 series calculator in this form (You can type a ...
user avatar
  • 21.2k
13 votes

40 Numbers in 9 Bytes

J, 15 2 + 1 * 3 * 2 + 3 This outputs only valid numbers, but a lot are duplicates. The unique values are ...
user avatar
  • 35.2k
13 votes

Do the NP: find the largest clique

Mathematica, 34 bytes Tr[1^#&@@FindClique[#<->#2&@@@#]]& Basically FindClique does the job and "finds a largest clique in the graph g." All ...
user avatar
  • 23.1k
13 votes

Drawing one-liner

Python, 31 bytes lambda l:sum(n%2for n in l)|2<3 Try it online! We use k|2<3 to check that ...
user avatar
  • 137k
13 votes
Accepted

Break The Chain

92+41=133 ...
user avatar
12 votes

Construct a graph

GolfScript (53 bytes) ])~{:^1>{.-1:H)-,:T;{..H):H*T@-:T+^%!{;}*}%}{^+}if}/, Online demo I haven't actually golfed this yet, but I have discovered that it's ...
user avatar
  • 42.8k
12 votes
Accepted

Golf Me An OOP!

CJam, 59 bytes q_'.e=\N/{)'?=\S/>_,(%}%/(__,*{(2$z~@f=.*\m*|}/ff{1$e=>:=N} This finishes instantly for both test cases. It either prints the second name ...
user avatar
  • 206k
12 votes
Accepted

Seeking Leapers

Pyth, 41 35 hfqQu@+G+VM*s_BM*F_BMTGQ]hQ)maVhQdt Exits on error if there are no valid leapers, giving the empty string if STDERR is ignored. Try it here or run a ...
user avatar

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