13
votes
11
votes
The smallest area of a convex grid polygon
Python, n=44 in under 2 minutes
This can go up to 44-gons in under 2 minutes, using pypy on my laptop.
CPython is slightly slower (2'45'').
The approach is rigorous. It uses the
dynamic programming
...
8
votes
Accepted
6
votes
Can I Clear The Grid?
JavaScript (ES11), 185 bytes
-3 thanks to l4m2
Expects a matrix of digits (with 0 for empty) and returns a Boolean value.
...
6
votes
9-16-25 2D Matrix
Brachylog, 43 bytes
{hlL;Mṁ₍+ᵐ~h?∧M\+ᵐ~t?∧Mc≠{>0∧.^₂≥?∧}ᵛL∧M≜}ᵐ
Try it online!
Takes about 5 seconds for all 3 cases on TIO.
Explanation
Since Brachylog uses ...
5
votes
Is it a Valid Crossword Grid?
Jelly, 40 35 33 bytes
-5 thanks to Nick Kennedy!
;ZµŒg§’:2;§Ȧ
ŒṪḢạ§ỊẸʋƇ@ƬiƊȧÇȧU⁼ṚƊ
A monadic Link that accepts a list of lists of ...
5
votes
5
votes
5
votes
How many cacti can I plant here?
Jelly, 34 bytes
ạSỊɗƇⱮ`
ŒJÇðZÆṁWfœịÐṀð€ẎŒPṚÇẈPƊÞḢL
A monadic Link that accepts a list of lists of positive integers, the landscape, and yields a non-negative ...
5
votes
Accepted
5
votes
9-16-25 2D Matrix
Python
To run the code, install the z3-solver
package. It can usually solve all three cases in ~1s.
...
4
votes
4
votes
Can I Clear The Grid?
Charcoal, 109 bytes
WS⊞υ⁻ι ≔⟦υ⟧υFυFLιF⌕A§ικ.«ιJλκ≔E⁴KDL⁺ι⌊ι✳⊗μθ≔EθΦ⁻⪫μω.¬πηFΦ⁴∧§ημ⊖№η§ημ§≔§θμ⌕§θμ§ημ.≔⪪⪫KAωL⌊ιεF¬⁼ει⊞υε⎚»⊙υ⬤ι¬⁻λ.
Try it online! Link is to verbose ...
4
votes
4
votes
3 Dimensional Minesweeper
JavaScript (ES6), 147 bytes
-1 thanks to emanresu A
Expects (dim0, dim1, dim2, mines), where mines is a list of comma-separated strings.
Output format: integers ...
4
votes
3
votes
A cube of text឵
Vyxal, 13 bytes
L?∞Ṫ»∨¹0²H»ø∧
Try it Online!
Indirectly -1 byte thanks to Kevin Cruijssen, I forgot how canvas operator overloading works.
...
3
votes
3
votes
3
votes
3
votes
3
votes
The smallest area of a convex grid polygon
Rust, n=44 in ~7 seconds
This is merely an abridged port of Günter Rote's solution, no original contribution.
...
3
votes
3
votes
3
votes
Is it a Valid Crossword Grid?
JavaScript (ES11), 176 bytes
Saved 1 byte thanks to @tsh
Expects a binary matrix, with 1 for white cells and 0 for black cells. ...
3
votes
3 Dimensional Minesweeper
Charcoal, 34 bytes
EθEη⭆Eζ⟦ιλν⟧⎇№εν*§⁺0βLΦε⬤ν‹↔⁻ς§πσ²
Try it online! Link is to verbose version of code. Takes the dimensions as three arguments followed by the ...
3
votes
3 Dimensional Minesweeper
MATLAB, 99 bytes
function M(s,m)
b=zeros(s);for n=m;b(n(1),n(2),n(3))=1;end;c=convn(b,ones(3,3,3),'same');c(b==1)=-1
Uses convn to do the convolution. Mines are ...
3
votes
9-16-25 2D Matrix
Nekomata + -1, 21 bytes
ᵃ#*R↕v#Š:ᵐ∑ᵈv=¿:∑ᵈ§=¿
Attempt This Online!
I just wanted to see how fast my golfing language can go. ...
2
votes
Very Simple Grid Marks
K (ngn/k), 10 bytes
{y#|x$"X"}
Try it online!
Takes input as two arguments; N as the first/left arg, and ...
2
votes
Highlight the Bounding Box, Part I: Cartesian Grid
Scratch, 550 bytes
(Hardly a golf, rather an exercise in Scratch to operate on strings and matrices)
Instructions:
Create a sprite with two costumes. Replace Costume 1 with a dot ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
grid × 383code-golf × 347
ascii-art × 48
decision-problem × 47
string × 45
path-finding × 41
geometry × 40
game × 29
combinatorics × 27
graph-theory × 22
math × 19
array × 19
puzzle-solver × 19
sequence × 16
number × 15
code-challenge × 14
matrix × 13
chess × 13
tiling × 13
counting × 12
random × 11
binary-matrix × 11
fastest-code × 10
king-of-the-hill × 10
maze × 10