# Tag Info

1

Java (JDK), 235 233 bytes int c(int[][]m,int x,int y,int b){int a=0,v;try{v=m[x][y];if(v*(b-=v)<0)v/=0;m[x][y]=-1;if(x==m.length-1&y==m.length-1)return 1;a=c(m,x+1,y,b)+c(m,x-1,y,b)+c(m,x,y+1,b)+c(m,x,y-1,b);if(a<1)m[x][y]=v;}catch(Exception e){}return a;} Try it online! Requires an int[][] with 0 as field and 1 as wall. Returns 0 on failure ...

0

APL (Dyalog Extended), 2 bytes ⍸< Try it online! I win. (Though it's technically tie because we don't count flags in bytes anymore...) Basically works like the existing APL answer, but it doesn't test for equality with '#'; it tests if each char is non-blank.

2

Charcoal, 81 bytes ≔⟦⟧θＷＳ⊞θι⊞υ⟦⊕Ｎω⟧≔⁰ηＦυ«⪫θ¶←Ｆ§ι¹✳κ+¿∨ⅈⅉＦruld«≔⌕….#§ι⁰∨⊟ＫＤ²✳κ+ζ¿⊕ζ⊞υＥι⁺λ⎇μκ±ζ»≔¹η⎚»η Try it online! Link is to verbose version of code. Based on my answer to the previous challenge. Works better on grids with lots of walls. Bomb count is separated from the grid by a blank line. Outputs a Charcoal boolean, i.e. - for a path, nothing if not. ...

3

JavaScript (ES7),  126 125  119 bytes Expects (matrix)(bombs), where the matrix is filled with -1 for an empty cell and -2 for a wall. Returns false if we can exit the maze, or true if we can't. m=>g=(b,X=0,Y=0)=>m.every((r,y)=>m[Y+1]||r[X+1]?r.every((v,x)=>r[x]*=v>0|(X-x)**2+(Y-y)**2!=1||g(b-~v,x,y,r[x]=1)):b<0) Try it online! Commented ...

0

Python 3.8, 228 bytes Similarly to Arnauld's answer, this uses my answer to Number of domino tilings to feed SymPy's find_linear_recurrence function. from math import* import sympy,sympy.abc as s def f(m):N=2**m+2;return sympy.sequence([round(abs(prod(2*cos((i//k+1)*pi/-~m)+2j*cos((i%k+1)*pi/-~k)for i in range(m*k)))**.5)for k in range(N)],(s.n,1,N))....

2

Python 2,  327 ... 249  246 bytes Saved 37 bytes thanks to fireflame241! This is using a port of my JS answer to Number of domino tilings to feed SymPy's find_linear_recurrence() method. import re,sympy,sympy.abc as s L=;N=2**input()-1;a=*N+L;R=range(N+1) for _ in+R:a=[sum(a[k]*(~k&~i&N<bool(re.match("0b(0*11)*0*$",bin(k&i))... 3 Charcoal, 92 bytes ≔⟦⟧θＷＳ⊞θι⊞υ⟦⁰¦⁰ω⟧≔⟦⟧ηＦυ«⪫θ¶←Ｆ§ι²✳κ+¿∨ⅈⅉＦruld«≔⊟ＫＤ²✳κζＦ№#.∨ζ+⊞υＥι⁺μ⎇⁼ν²κ⁼ν⌕#.ζ»⊞ηι⎚»Ｆ⊟⌊η✳ι+¦+ Try it online! Link is to verbose version of code. Times out for larger grids (can just about do 3×8 but can't do 4×6). Takes grid in example format and outputs using +s and spaces. Explanation: ≔⟦⟧θＷＳ⊞θι Input the grid. ⊞υ⟦⁰¦⁰ω⟧ Start with an ... 4 APL (Dyalog Unicode), 72 bytes {⍵=1:⍳2⋄(2*⌈⍵÷2)(⌷⌹⍉⍤↑)⍉L↑⍉↑,¨+.×\(L←2*⍵)⍴⊂∘.((0∊+)⍱1∊2|×≢¨⍤⊆⊣)⍨⍸1⍴⍨⍵⍴2} Try it online! (uses a polyfill for ⍤ since TIO is not updated to 18.0 yet) Requires ⎕pp←2 (implicit rounding of output) and ⎕IO←0 (0-indexing). We compute a transition matrix, then use the approach listed in S. Białas and M.Białas to find the minimum ... 4 JavaScript (ES7), 198 185 179 178 bytes Expects a matrix of integers with -1 for a wall and 0 for an empty cell. Returns a matrix of Boolean values. m=>(g=(Y,w,n,X)=>w>=W&&w>W|n>N?0:m[Y+1]||1/m[Y][X+1]?m.map((r,y)=>r.map((v,x)=>v>0?1:(X-x)**2+(Y-y)**2^1?0:r[r[x]=1,g(y,w-v,-~n,x),x]=v)):o=g(-1,W=w,N=n))(0,0,W=++m/0,0)&... 1 Java 10, 242 236 bytes import java.awt.*;v->new Frame(){{add(new Panel(){public void paint(Graphics g){for(int i=9,t;i-->0;g.setColor(Color.BLACK),g.fillOval(t%3*10+1,t/3*10+1,8,8),g.setColor(Color.GRAY),g.drawRect(i%3*10,i/3*10,10,10))t=i>4?i:1;}});show();}} -6 bytes thanks to @ceilingcat. Screenshot of the actual 30x30 pixels result: Screenshot ... 0 Pip, 59 bytes Oy, Pip can be verbose for a golfing language sometimes... YsXbRLcJnWa{T X#a~yx:Y(t:{J*Z:a^n}Jny)Y$.a.$'--a}x?(ty)y Try it online! Ungolfed Approach: store the grid as a newline-separated string, using regex to replace a run of spaces with the current number, and transposing if there isn't a run of spaces long enough. ; Command-line ... 1 C (gcc), 289 $\cdots$ 246 243 bytes Saved a whopping 37 41 43 46 bytes thanks to ceilingcat!!! q;c;v;s;d;i;b;u;r;f(g,e,w,p,n)int*g,*p;{r=wcslen(g);for(c=d=0;c-n&&!d;!d&c<n&&--g[r=s])for(c=n,b=4;b--;d=v?q<c?c=q,s=u,0:q>c?d:1:d)for(i=~-(b&2)*(b&1?1:w),v=g[u=r+i]*(u>=0&u<e)*(r%w|~i&&r%w-w+1|i-1),q=0,i=n;... 1 J, 109 bytes Takes in the program on the left, the grid on the right, and returns the 1-based end position. ($-_2&u)@((](r@|.~d{.@/:])[@.(]2=/@{./:~)[i.(d=:(,-)=i.2){::])^:_)0(]|.~u=:$@]#:(i.~,))_1(r=:-1$!.0~$)@,._,] Try it online! How it works Because I didn't want to handle 3 arguments (program + grid + current position) as this is awkward in tacit J ... 3 JavaScript (ES7), 142 130 bytes Expects (program)(matrix), with highest precedence coming first for the program. Returns [column, row], both 0-indexed. p=>m=>(g=(a,X,Y)=>a.some(k=>m.map((r,y)=>r.map((v,x)=>(X-x)**2+(Y-y)**2-1|v^k||(H=x,V=y,n--)),n=1)|!n)?g(p,H,V,m[V][H]--):[X,Y]) Try it online! Commented p => m => ( /... 4 Python 2, 205 198 bytes def s(g,w,r): p=g.index(0) while 1: a=[((r+).index(v),n)for n,v in enumerate(g)if(abs(n-p)in[1,w])>(p-n)%w*(p/w!=n/w)];m,n=min(a) if~-sum(k==m<len(r)for k in a):return p/w,p%w p=n;g[p]-=1 -6 bytes thanks to @ovs -1 byte thanks to @user202729 Try it online! Take the input grid as a flattened list with width ... 3 Charcoal, 70 bytes ≔⪪Ｓ¹θＷＳ⊞υι≔⪫υ¶ηＰη…η⌕η0≔ＥＫＶ⌕θιυＷ⁼¹№υ⌈υ«Ｍ✳⁻χ⊗⌕υ⌈υＰＩ⊖ＫＫ≔ＥＫＶ⌕θκυ»≔⟦ⅈⅉ⟧υ⎚Ｉυ Try it online! Link is to verbose version of code. Takes input as the program in ascending order of priority and then the newline-terminated grid and outputs 0-indexed coordinates. Explanation: ≔⪪Ｓ¹θ Input the program as separate characters. ＷＳ⊞υι≔⪫υ¶η Input the grid.... 1 PowerShell 6, 244 254 bytes De Bruijn sequence is a good idea. Thanks to Level River St param($w,$h)for(;$z='A'..'Z'|?{"Z$x"-notmatch-join"$x$_"[-2..-1]}){$x+=''+$z}$v=random 9 1..$h|%{$y=$_+$v ,(($r=1..$w)|%{"\ $($x[$y+$_-1]) /"})+,($r|%{$x[$_-1]+' X '+$x[$_]})+,($r|%{"/ $($x[$y+$_]) \"})|%{$_-join' | '} ,'-----'*$...

1

About 200 ms function mark() { var t = 0, tp = ''; var c = [], i = { r: 0, p: '', c: 0 }; var elements = document.body.getElementsByTagName('*'); var length = elements.length, index, v; for (index = 0; index < length; ++index) { v = elements[index]; switch (v.tagName) { case 'TH': case 'TD': v.className = i.p + i.c++; ...

2

APL (Dyalog Unicode) 18.0, 23 bytes -∘(+/)⍥(×⍨)⌹⍥(2-⌿⊢)¯2×⊢ Try it online! A tacit infix function that can be called like dists f pts, where pts contains three centers' coordinates as a 3-row 2-column matrix, and dists contains three distances to the respective centers. Uses 18.0 feature ⍥. TIO's Dyalog Unicode is not updated yet from 17.1, so TIO link ...

1

APL (Dyalog Unicode), 53 bytes {⌊/×/¨⍸{∧/,⍲/¨'ab'∘∊¨⊃{⍉,⌿↑⍺⊂⍵}/(⊂,⍨⍴⍴¨⍺↑¨≡)⍵}∘⍵¨⍳⍴⍵} Try it online! A function that takes a character matrix as the argument. Basically, tries all possible tile sizes, testing if partitioning by that size would give at most one of ab on every cell. Illustration Example input: a aa ab ba aba Example tile size: 2 rows, 2 ...

Top 50 recent answers are included