Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

Hot answers tagged

92 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 ...
user avatar
  • 206k
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 ...
user avatar
52 votes
Accepted

Red vs. Blue - Pixel Team Battlebots

Blue Team - SphiNotPi3000 ...
user avatar
  • 28.5k
49 votes

Red vs. Blue - Pixel Team Battlebots

Blue Team - SphiNotPi3000 ...
user avatar
  • 60.9k
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 ...
user avatar
  • 38.7k
35 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 <...
user avatar
  • 839
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 ...
user avatar
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 ...
user avatar
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 ...
user avatar
  • 2,158
31 votes
Accepted

Display the Hacker Logo

Mathematica, 62 bytes Grid[{{,a=██,},{,,a},{a,a,a}},Frame->All,FrameStyle->Gray] Mathematica, 71 bytes ...
user avatar
  • 23.1k
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
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 ...
user avatar
  • 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 ...
user avatar
  • 32.6k
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 ...
user avatar
26 votes

Display the Hacker Logo

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

Display the Hacker Logo

Python 2,  169 140  137 bytes ...
user avatar
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. ...
user avatar
  • 137k
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 ...
user avatar
  • 206k
22 votes

How many towers can you see?

APL 19 ≢¨∪/⌈\(⍉⍪⌽⍪⊖∘⌽∘⍉⍪⊖) (golfed a bit more after ngn's suggestion, thanks) Explanation: ...
user avatar
  • 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 ...
user avatar
  • 60.9k
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 ...
user avatar
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 ...
user avatar
  • 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 ...
user avatar
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 ...
user avatar
  • 99.4k
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
21 votes

Red vs. Blue - Pixel Team Battlebots

Red Team - SeekerBot ...
user avatar
  • 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 ...
user avatar
  • 4,911
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. ...
user avatar
  • 8,341

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