Share Your Experience: Take the 2024 Developer Survey

Tag Info

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 ...
• 197k

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}$.
• 20.6k

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

Accepted

Display the Hacker Logo

Mathematica, 62 bytes Grid[{{,a=██,},{,,a},{a,a,a}},Frame->All,FrameStyle->Gray] Mathematica, 71 bytes ...
• 24.9k
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 ...
• 31.4k

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 ...
• 197k

Display the Hacker Logo

GLSL (fragment shader), 278 235 256 bytes ...
• 696

Display the Hacker Logo

Python 2,  169 140  137 bytes ...
• 107k

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. ...
• 145k

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 ...
• 105k

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 ...
• 59.2k

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 "...
• 16.7k
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. ...
• 14.9k

Generate an ascii-art non-intersecting path

Befunge, 344 bytes ...
• 8,918

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. ...
• 8,479

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 ...
• 43.8k

Square snowflake

MATL, 21 19 bytes l31:"TTYat3Y6Z+1=Y| Try it online! Explanation ...
• 105k

Obfuscate my ><>

><>, 555 bytes ...
• 7,350

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

Formic Functions - Ant Queen of the Hill Contest

Sliding Miners 6.4 ...
• 20.3k

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 @...
• 6,208

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) ...
• 14.9k

Python 2, 52 bytes f=lambda n:n<6orn%100in'18349276167294381'*f(n/10) Checks that any two consecutive digits are in the string ...
• 145k

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 ...
• 3,206

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. ...
• 193k

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) ...
• 1,161