Skip to main content
Share Your Experience: Take the 2024 Developer Survey
55 votes
Accepted

Is my prison secure?

Snails, 13 bytes !(t\P(o\ ),o~ Try it online! Prints 0 for insecure prisons and the size of the input's bounding box for ...
Martin Ender's user avatar
42 votes

When will the DVD logo hit the corner?

Wolfram Language (Mathematica), 27 bytes ChineseRemainder[-#,#2-#3]& Try it online! This is the least \$t\ge0\$ such that \$i+t\equiv0\pmod{g-d}\$.
att's user avatar
  • 20.6k
36 votes

Display the Hacker Logo

CSS+HTML, 56+84=140 bytes 52+84=136 bytes Saved 4 bytes by incorporating suggestions from the comments. td{border:1px solid#888;line-height:.4;font-size:3em <...
Octopus's user avatar
  • 849
34 votes

Solve Grid-Tangram

BBC BASIC, 570 514 490 bytes ASCII Download interpreter at http://www.bbcbasic.co.uk/bbcwin/download.html 435 bytes tokenised Full program displays an input from ...
Level River St's user avatar
32 votes
Accepted

Display the Hacker Logo

Mathematica, 62 bytes Grid[{{,a=██,},{,,a},{a,a,a}},Frame->All,FrameStyle->Gray] Mathematica, 71 bytes ...
ZaMoC's user avatar
  • 24.9k
27 votes
Accepted

Will I make it out in time?

Snails, 15 bytes \Oo!{.,fee7.,\F Try it online! 1 means survival while 0 means death. Since ...
feersum's user avatar
  • 31.4k
26 votes

Recognize a vine

Snails, 25 19 17 bytes & \0z),(\1dlr)+d~ Try it online! Explanation Snails is a 2D pattern-matching language inspired by regex, which was originally ...
Martin Ender's user avatar
26 votes

Display the Hacker Logo

GLSL (fragment shader), 278 235 256 bytes ...
Frxstrem's user avatar
  • 696
25 votes

Display the Hacker Logo

Python 2,  169 140  137 bytes ...
Jonathan Allan's user avatar
25 votes

Maximum number of squares touched by a line segment

Python 2, 27 bytes lambda L:(2*L*L-2)**.5//1+3 Try it online! A direct formula: $$ f(L) = \lfloor \sqrt{2 L^2-2}\rfloor + 3 $$ Derivation As noted by @Kirill L. ...
xnor's user avatar
  • 145k
23 votes

Fill in the Minesweeper clues

MATL, 18 17 bytes Thanks to @mbomb007 for a correction in the input of test case 6 32>t3Y6Z+-6b(48+c Input is a 2D char array, in the format ...
Luis Mendo's user avatar
  • 105k
22 votes

A square of text

Vim, 59, 57, 48 bytes/keystrokes $:let @q=float2nr(sqrt(col('.')))."|li<C-v><cr><C-v><esc>@q"<cr>@q Since V is backwards ...
DJMcMayhem's user avatar
  • 59.2k
22 votes

When will the DVD logo hit the corner?

Python, 59 bytes -1 thanks to @xnor f=lambda i,I,g,G,d,D:i%(g-d)+I%(G-D)and-~f(i+1,I+1,g,G,d,D) Attempt This Online! Based on the observation that we can "...
loopy walt's user avatar
  • 16.7k
20 votes
Accepted

There's an ant on my Rubik's Cube

Perl, 156 143 134 128 127 125 120 119 117 113 109 bytes Includes +1 for -p Run with the control string on STDIN, e.g. ...
Ton Hospel's user avatar
  • 14.9k
20 votes

Generate an ascii-art non-intersecting path

Befunge, 344 bytes ...
James Holderness's user avatar
20 votes

Formic Functions - Ant Queen of the Hill Contest

Forensic Ants All my answers are sharing the same set of low-level helper functions. Search for "High-level logic begins here" to see the code specific to this answer. ...
Dave's user avatar
  • 8,479
20 votes

Partitioning the grid into triangles

Haskell, 60 55 54 52 bytes After a drawing and programming a lot of examples, it occured to me that this is the same as the problem of the rooks: On a \$(n+1) \times (n+1)\$ chessboard, how many ...
flawr's user avatar
  • 43.8k
20 votes

Square snowflake

MATL, 21 19 bytes l31:"TTYat3Y6Z+1=Y| Try it online! Explanation ...
Luis Mendo's user avatar
  • 105k
20 votes

Obfuscate my ><>

><>, 555 bytes ...
tjjfvi's user avatar
  • 7,350
19 votes

Stuffing primes in a box

Smalltalk, 1098 primes First off, nice hard question - as evidenced by the lack of non-trivial responses thus far. I had a solution cooking at work, but had to wait for the long weekend to have time ...
Amos M. Carpenter's user avatar
19 votes

Formic Functions - Ant Queen of the Hill Contest

Sliding Miners 6.4 ...
dzaima's user avatar
  • 20.3k
19 votes

N-movers: How much of the infinite board can I reach?

JavaScript (Node.js), 144 138 125 74 73 70 bytes f=(x,n=2,c=0)=>x%n?x-!c?f(x,n+1)/(n%4>2?n/=~c&1:n%4)**c:1:f(x/n,n,c+1) Try it online! -4 byte thanks @...
Shieru Asakoto's user avatar
18 votes

Determine winner of Connect 4

Perl, 119 118 117 bytes Includes +4 for -0p Give rotated board padded with spaces on STDIN (gravity pulls stones to the right) ...
Ton Hospel's user avatar
  • 14.9k
18 votes

A Numpad's Knight Numbers

Python 2, 52 bytes f=lambda n:n<6or`n%100`in'18349276167294381'*f(n/10) Checks that any two consecutive digits are in the string ...
xnor's user avatar
  • 145k
18 votes

Island Golf #1: Circumnavigation

Mathematica (version 9), 165 bytes The nice, short ConvexHullMesh function that Greg Martin used was only introduced in Mathematica version 10, so I thought I'd ...
Not a tree's user avatar
  • 3,206
18 votes

Recognise a Digit from a Positional Encoding

JavaScript (Node.js),  89 ... 77  71 bytes Saved 6 bytes by using the modulo chain provided by @KjetilS. ...
Arnauld's user avatar
  • 193k
17 votes

Gravity simulator

Marbelous, 19561 bytes (Not that I tried to optimize the size.) This claims the final bounty here. This expects a trailing newline in the input. It works for boards up to 15x15 (including the edges) ...
user197974's user avatar
  • 1,161
17 votes

Is this square symmetrical?

CJam, 16 bytes {{z_W%_}4*;])e=} An unnamed block which expects the input as a list of four strings on top of the stack and leaves a ...
Martin Ender's user avatar
17 votes

Game of Life arrowslits

Python 2, 142 136 135 bytes -6 bytes thanks to ElPedro -1 byte thanks to TuukkaX ...
Rod's user avatar
  • 18.4k

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