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 ...
48
votes
38
votes
34
votes
Accepted
Black and White Rainbows
Matlab, 255 245 231 bytes
This expects the image name first, then y and then x.
...
21
votes
Accepted
A Mouse with Dynamite
Perl, 216 215 bytes
Includes +2 for -0p
Give input on STDIN. Use % for external walls, # ...
19
votes
Accepted
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.
...
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 ...
16
votes
Is my prison secure?
C# (.NET Core), 485 480 474 470 421 408 bytes
The absolutely wrong tool and approach, but nonetheless...
7 bytes (and more) saved with the useful tips from TheLethalCoder.
4 bytes saved by returning ...
15
votes
Is my prison secure?
Perl 5, 69 bytes
-10 bytes thanks to @Grimy.
-2 bytes thanks to @Neil.
77 byte of code + -p0 flags.
...
15
votes
Weight of the Least Weighted RoD Path
J, 42 bytes
v(+}.<.}:)&.>/@{.[:</.(2#v=._1+1#.$){.!._]
Try it online!
How it works
...
14
votes
Accepted
Find the right path
Slip, 47 bytes
`a(?,[`-+]*((`/<|`\>)[`|+]*(`/>|`\<)[`-+]*)*`:)
Test it here.
Yay for undocumented features...
Explanation
Slip is basically a two ...
13
votes
A Mouse with Dynamite
JavaScript, 863 834 785 781 bytes
Saved 29 bytes thanks to ETHproductions
Saved 53 bytes thanks to Jordan
...
13
votes
13
votes
Accepted
A Turtle Finds a Portal
JavaScript (ES7), 140 139 138 bytes
Takes input as a matrix of integers with the following mapping:
\$-1\$ = 🔵 (any portal)
\$0\$ = \$X\$ (empty)
\$1\$ = 🌄 (mountain)
\$2\$ = 🐢 (turtle)
\$3\$ = �...
13
votes
Is there a left-right connection?
MATLAB/Octave, 115 109 98* bytes
-6 bytes thanks to Luis Mendo
-7 bytes thanks to Luis Mendo
...
12
votes
Generating Picture Mazes
Python 3, 1491 Bytes
I found this to be a fun project and very interesting (and somewhat lengthy). When I saw this, I was reminded of the summer I spent exclusively writing and improving a maze ...
12
votes
Unlock your Lock
Python 2, 113 107 105 99 95 bytes
a,b=input()
i=0
print a
for x in a:
while x-b[i]:a[i]=x=(x+(x-b[i])%10/5*2-1)%10;print a
i+=1
Try it online!
Takes input as ...
12
votes
Delannoy numbers
Jelly, 8 bytes
Żc@Ɱ,PṚḄ
Try it online!
Because I couldn't tolerate Jelly being tied with APL.
Again uses the formula
$$D(m,n) = \sum_{k=0}^{\min(m,n)} \binom{m}{k} ...
12
votes
Who Is Kevin Bacon?
BQN*, 53 45 bytesSBCS
{1+⊑⍒+˝+´(∨∨∨˝∘×⎉1‿∞)⍟n˜∨⟜⍉∨˝𝕩≡⌜1+⋈⌜˜n←↕⌈´∾𝕩}
Run online!
Theory:
Let \$k\$ be the maximum node id. Then the node IDs are \$\{1, 2, ..., k\}...
11
votes
Accepted
11
votes
Accepted
Can Mario go to the end of this map
Slip, 38 27 25 bytes
S>(`=<<`P{1,5}>`P>`P*)+#E
Requires input to be padded to a rectangle such that there are spaces in every cell Mario needs to ...
11
votes
Island Golf #1: Circumnavigation
(But go upvote Notatree's solution, it's better!)
Mathematica, 168 bytes
...
11
votes
11
votes
Constructing an evil maze against random exploration
No dead ends near the entrance, 21,477,560 21,485,005
Try it online!
Yay, 21 million. The giant horizontal segments up to row 19 are also removed, so about 20% of the entire grid is just an open space....
11
votes
10
votes
How varied is my obstacle course?
Python 2, 170 131 112 bytes
def f(C,t=1):i="#".join(C).find("#")+1;return([]<C)*(i<1or(i<t
and f([r[i:]for r in C],t-i))+(i>1)*f(C[1:],i-1))
A ...
10
votes
Combination bike lock
Matlab, 412 327 bytes
Golfed (Thanks to @AndrasDeak for golfing s!):
...
10
votes
Island Golf #1: Circumnavigation
Python 3, 779 bytes (indenting with tabs)
This is the whole program. It reads input from stdin and prints it to stdout. Stdin must end with EOF.
Example run with the big input: https://ideone.com/...
10
votes
Is the room lit up?
Vyxal, 29 27 25 23 bytes
2(⌈ƛƛ:×c[¶1V];Ṅ;∩vṅ)∑¶↔
Split on wall, check if any spilt contain light, replace it with 1, transpose, do it again, check sum.
outputs ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
path-finding × 135code-golf × 113
grid × 41
graph-theory × 16
code-challenge × 15
ascii-art × 14
maze × 14
decision-problem × 11
puzzle-solver × 9
game × 7
string × 6
geometry × 5
king-of-the-hill × 5
sequence × 4
combinatorics × 4
graphical-output × 4
matrix × 4
sorting × 4
optimization × 4
array × 4
math × 3
permutations × 3
fastest-code × 3
chess × 3
hexagonal-grid × 3