Hot answers tagged

93 votes
Accepted

Rearranging Words

CJam, 58,598 58,494 57,898 57,772 57,704 57,680 moves This approach takes the family of all unordered sets of horizontal moves of minimum cardinality (with some false positives) and adds the minimum ...
  • 207k
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 ...
52 votes
Accepted

Red vs. Blue - Pixel Team Battlebots

Blue Team - SphiNotPi3000 ...
  • 28.6k
49 votes

Red vs. Blue - Pixel Team Battlebots

Blue Team - SphiNotPi3000 ...
  • 61.1k
43 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}\$.
  • 17.2k
40 votes
Accepted

Shortest universal maze exit string

C++, 97 95 93 91 86 83 82 81 79 characters My strategy is fairly simple - an evolution algorithm that can grow, shrink, swap elements of and mutate valid sequences. My evolution logic is now nearly ...
  • 38.8k
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 <...
  • 849
34 votes

Print all colorings of a 3x3 grid

Mathematica, 25 bytes Image/@{0,1}~Tuples~{3,3} Gives an array with all the grids as images, which is also directly displayed on screen: (Cropped so as not to ...
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 ...
32 votes

Language Design: 2-D Pattern Matching

SnakeEx Solves 15/16 problems so far! Online Interpreter! - Full Language Spec - Javascript Source The idea behind this language is to define 'snakes' that move around the text checking characters ...
  • 2,158
32 votes
Accepted

Display the Hacker Logo

Mathematica, 62 bytes Grid[{{,a=██,},{,,a},{a,a,a}},Frame->All,FrameStyle->Gray] Mathematica, 71 bytes ...
  • 23.3k
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. <...
  • 61.1k
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 ...
  • 30.9k
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 ...
  • 32.7k
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 ...
26 votes

Display the Hacker Logo

GLSL (fragment shader), 278 235 256 bytes ...
  • 686
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 ...
  • 61.1k
24 votes

Display the Hacker Logo

Python 2,  169 140  137 bytes ...
24 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. ...
  • 139k
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 ...
  • 207k
23 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 "...
  • 9,258
22 votes

How many towers can you see?

APL 19 ≢¨∪/⌈\(⍉⍪⌽⍪⊖∘⌽∘⍉⍪⊖) (golfed a bit more after ngn's suggestion, thanks) Explanation: ...
  • 1,629
22 votes

Language Design: 2-D Pattern Matching

Slip, Python 3.4 (Github wiki, online interpreter) Like feersum's submission this is also based on traversing the grid, but like CarpetPython's submission this is based on regex. Somehow it looks ...
  • 61.1k
22 votes
Accepted

Dennis, Doorknob, Martin Büttner, Chris Jester-Young - Pizzeria!

CJam, 20 bytes q~1$*4/"CEDM"e*/:$N* I think this should work :) Try it online Explanation: This first makes a pizza labeled CC…EE…DD…MM… from left to right ...
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 ...
  • 12.4k
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 ...
  • 57.4k
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 ...
  • 100k
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! ...
  • 3,858
21 votes

Red vs. Blue - Pixel Team Battlebots

Red Team - SeekerBot ...
  • 311
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 ...
  • 4,921

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