Hot answers tagged

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
  • 19.7k
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.4k
28 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.3k
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

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
  • 144k
24 votes

Display the Hacker Logo

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

Invert a Minesweeper Board

CJam, 58 57 bytes 0WX]2m*qN/{'*f+z}2*f{\~@m<fm<W<}:..+{W<{_'*#'*@'*-,?}/N}/ Input should not end with a linefeed. Output contains ...
Dennis's user avatar
  • 210k
22 votes

Fill the rows, columns, and diagonals of an NxN grid with 1 through N

Funciton, non-competitive UPDATE! Massive performance improvement! n = 7 now completes in under 10 minutes! See explanation at bottom! This was good fun to write. This is a brute-force solver for ...
Timwi's user avatar
  • 12.9k
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
  • 58.9k
22 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
  • 104k
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
21 votes

Can I Slide Apart The Puzzle?

CJam, 33 32 20 19 17 bytes Revised version, with massive support from @Sp3000 and @MartinBüttner: qN/_z]{:e`z,3<}/| Try it online Contributions @Sp3000 ...
Reto Koradi's user avatar
  • 4,931
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.8k
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,451
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.7k
20 votes

Square snowflake

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

Obfuscate my ><>

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

"Fill the Grid" Problem

CJam, 119 91 bytes q~:M;),>:R;(:L{{R{ML)d/-Y#)mr}$L/L<2{{M1$:+-+}%z}*:U:+__O|=R*-}gU{:s_:,:e>f{Se[}}%zSf*N*}M? This is a provably correct, non-...
Dennis's user avatar
  • 210k
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.2k
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.8k
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. ...
Ton Hospel's user avatar
  • 14.8k
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
  • 144k

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