Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Challenges

Post History

77%
+5 −0
Challenges Longest parallel lines

JavaScript (Node.js), 541 540 bytes for(_='=>)==!(+==0h,.map(M,R(=1,,e,b &&Nl=[-1,))s(n,=(a a=u,v(i=g(z,u,f=(a,w,cs=Math.max,r?[...r(--a ) (a)]:[],R>&b>&a<w&b<...

posted 4y ago by Hakerh400‭  ·  edited 4y ago by Hakerh400‭

Answer
#6: Post edited by user avatar Hakerh400‭ · 2021-02-03T07:19:54Z (almost 4 years ago)
  • # [JavaScript (Node.js)], 541 bytes
  • <!-- language-all: lang-javascript -->
  • <pre><code>for(_='=&gt;&#20;)&#20;&#19;+=&#18;=0&#17;h,&#16;.map(&#15;&#20;M&#15;&#14;,R(&#12;=1,&#11;,e&#9;,b&#8;=[-1,&#7;&amp;&amp;&#6;=u,v(i&#20;&#5;))&#4;&#4;&#4;&#6;s(n,&#3;=(a&#8;&#19;a&#2;=g(z,u,&#1;f=(a,w,&#16;c&#11;s=Math.max,r&#2;?[...r(--a&#8;)&#8;(a)]:[],R&#2;&gt;&#17;&amp;b&gt;&#17;&amp;a&lt;w&amp;b&lt;&#16;g=(f&#8;,c,d&#9;&#17;&#19;(v(i&#20;(f&#18;c&#8;&#18;d&#9;++&#12;f&#8;)?a[b][f]:!(e&#17;&#4;)&#9;),v=f&#20;r(w+&#16;s).some(f),n&#17;&#19;a&#15;(c,u&#19;c&#15;(f,z&#19;!f||!((M&#7;1])&#15;o&#14;l&#14;N&#14;O&#20;(o-N||l-O)&amp;(o+N||l+O)&#6;(P&#1;o,l&#4;&#6;(Q&#11;x=z,y&#5;(x&#18;N,y&#18;O&#12;x,y)&#6;a[y][x]&amp;g(x,y,o,l)==P&#6;Q++&#4;,n=s(n,Q&#4;&#4;&#4;,m&#1;1,0&#4;||(d&#1;0,1),n&#7;0,k=1]&#15;p&#20;[!(d&#6;p),1]&#15;q&#20;(j&#11;t=z&#9;&#5;!(e++,t&#18;p&#12;t&#9;)&#6;a[e][t]&amp;g(t&#9;,q,!q)==(q?m:d)&#6;++j&#4;,k=s(k,j&#3;k&#3;c&#6;f(r(w,g&#20;r(&#16;f&#20;a[f][g]&#4;,&#16;w,0&#4;';G=/[&#1;-&#20;]/.exec(_);)with(_.split(G))_=join(shift());eval(_)
  • </code></pre>
  • [Try it online!][TIO-kkp2nxd9]
  • [JavaScript (Node.js)]: https://nodejs.org
  • [TIO-kkp2nxd9]: https://tio.run/##bVPLcqpAEC0TQnyVTz4AN9pTtAjbmEmWWSUm2SJlRgTUICAQX8W/ewfDNcm9YQrm9Jzuc2aamiXbsNiKFmHS94OZfTw6QQQT2qN3EpHaCm1RrTnHhrpiIdSlx3oNX6FKdaygXcJpkRp9Ha@7XZF@4AYW0hUhgiCIMfh4SYEV2@yCunDADyw4PMYtNqxKTB9ZMueSO4wu7g1VVSPo91mRFIER88Yw8fXirtmd8pfdbrvT24ZLwSmihbNSsw2ZDzgtq9ialRSl6hTJPTOmpuGYNx2wmwIpEdxQR4pgqzRiosbBygaHoN9sszpY@NG26uDgod1x0rQD8Hitm6Qe1LzaU20kQdB/SlOvPyJdCJQMKiMiwnMhQE8Q4aWyowfcX8Gu9YT71qi6wz0RmbE3jZ3ZdYGHyDMJpc/ii6II6NOsGS@8K7gq6KgJaQqzgoY639C1hu9UN@uhZHRgJoYEebCWYFlJ6KF0xU@jKJi0wmpSyjxs00gyj6SEa@ysuQes71c3MyIqylLgUjG84/Ly/dISHeCnR5f3oOFIjLfGcE0BG1vu3xs@0IFR6EvmQLV3tgUTMiTbRTKHiRqH3iKBB0ImdBksfIjnCycBQob2hnk88Ti0Aj8OPFv1AhfeymVN1k9DkzWOz@O8njEn4rekPNDLX1Vf1ecEPU/RP3E5n/@lfyL9l7UMlb80crt8F@cl/buw9s1X@9/3N5p7fE76N6fym5pEixUQNbJDj1k2DMbR2E/HUTr2By7KvbHfI3n7OT5FZVnObh2T6Z38@XX4DZKZoZmqZ/tuMudBjggB9teC18nyWYoLnVXOKTkr/yDlVNYIf9TTr89IMjz@AQ "JavaScript (Node.js) – Try It Online"
  • # [JavaScript (Node.js)], <del>541</del> 540 bytes
  • <!-- language-all: lang-javascript -->
  • <pre><code>for(_='=&gt;&#23;)&#23;&#22;==&#21;!(&#20;+=&#19;=0&#18;h,&#17;.map(&#16;&#23;M&#16;&#15;,R(&#14;=1,&#12;,e&#11;,b&#9;&amp;&amp;&#8;N&#8;l&#21;&#7;=[-1,&#6;))&#5;&#5;&#5;&#8;s(n,&#4;=(a&#9;&#22;a&#3;=u,v(i&#23;&#20;&#2;=g(z,u,&#1;f=(a,w,&#17;c&#12;s=Math.max,r&#3;?[...r(--a&#9;)&#9;(a)]:[],R&#3;&gt;&#18;&amp;b&gt;&#18;&amp;a&lt;w&amp;b&lt;&#17;g=(f&#9;,c,d&#11;&#18;&#22;(v(i&#23;(f&#19;c&#9;&#19;d&#11;++&#14;f&#9;)?a[b][f]:&#20;e&#18;&#5;)&#11;),v=f&#23;r(w+&#17;s).some(f),n&#18;&#22;a&#16;(c,u&#22;c&#16;(f,z&#22;!f||&#20;(M&#6;1])&#16;o&#15;l&#15;N&#15;O&#23;&#20;(o&#21;&#7;O)|(o&#21;-&#7;-O&#5;&#8;(P&#1;o,l&#5;&#8;(Q&#12;x=z,y&#2;x&#19;N,y&#19;O&#14;x,y)&#8;a[y][x]&amp;g(x,y,o,l)&#21;P&#8;Q++&#5;,n=s(n,Q&#5;&#5;&#5;,m&#1;1,0&#5;||(d&#1;0,1),n&#6;0,k=1]&#16;p&#23;[&#20;d&#8;p),1]&#16;q&#23;(j&#12;t=z&#11;&#2;e++,t&#19;p&#14;t&#11;)&#8;a[e][t]&amp;g(t&#11;,q,!q)&#21;(q?m:d)&#8;++j&#5;,k=s(k,j&#4;k&#4;c&#8;f(r(w,g&#23;r(&#17;f&#23;a[f][g]&#5;,&#17;w,0&#5;';G=/[&#1;-&#23;]/.exec(_);)with(_.split(G))_=join(shift());eval(_)
  • </code></pre>
  • [Try it online!][TIO-kkp3kwhs]
  • [JavaScript (Node.js)]: https://nodejs.org
  • [TIO-kkp3kwhs]: https://tio.run/##bVPLUqtAEK2oKHlUzJstbpKeokNgaxxdutKoW0LFCYE8JJAA5lX8e@4QuTHeK1PQ3XO6z5npYWZsxUIrmC6itueP7P3e8QMY0Ba9l4jUoLR@AzWFVqlWmWBZnbMFlKSn0jW@QZHqWEA7j8Nssyk@i279ihptHS8JEQRBDMHDCwos22Dn9BNXMJVqZ3QMO/zEjMMBXGPZKoT0iUUTTrzB4PzBUFU1gHabZUkWGDFvDRPfzu8rzSF/2d26Obwrjyk4WbRwlK80IKEFp2plq6O8ohSdLHlgxtA0HPO2ZlcEkie4oo4UwFoph0QN/bkNDkGv0mAlsPCzYZXAwV3jxonjGjxd6iYp@dfu9fN1T6qBX7/qkZib9lW7J4jwkvHR5fa1sKE73J5tqs@4rfaKG9wSkRlb09iYzTHwEHkiqb@Ir4oioEeTZrzyruA8o6MmxDGMMhrqfCGXGn5Q3SwtJKM2EhcEub@UYFaI6C5/ZisKRtVFMcon/LZpRAl/lMcl3ixJHZYP89sRERVlJnCaED5wdvFxYYkO8B3jmO@77EiMd8MYmwKW11y71X2kHSPTlsyOam9sCwakS9bTaAIDNVy40wgeCRnQmT/1IJxMnQgI6dor5vLEfdfyvdB3bdX1x/Cey2myfhiarHH/OI7zCXIAfktKAz33XfVdfUzQ0xT9y8@l9l/4p6f/Mpd4uW@OVC5dxXFKPyXWTnS1/3V/g7nGl9FPlE4WndofFWkfTtrDWd7VKJjOgaiBvXCZZUOnH/S9uB/Efa8zRrnV91okPTHuH6KcLCc3lMn0Xv76OvyeyczQTNW1vXE04UHqEQLsrwSvk@UjFSc6shxTUlT@AcqxrBH@qIe/JQFJd/8H "JavaScript (Node.js) – Try It Online"
#5: Post edited by user avatar Hakerh400‭ · 2021-02-03T06:54:08Z (almost 4 years ago)
  • # [JavaScript (Node.js)], <del>534</del> 510 bytes
  • <!-- language-all: lang-javascript -->
  • <pre><code>for(_='=&gt;&#19;)&#19;&#18;(f&#17;=0&#16;h,&#15;++,&#14;=1,&#12;,e&#11;=[-1,&#9;,b&#8;&amp;&amp;&#7;=u,v(i&#19;&#6;=(a&#8;&#18;a&#5;))&#4;&#4;&#4;&#7;s(n,&#3;=g(z,u,&#2;.map(&#1;f=(a,w,&#15;c&#12;s=Math.max,r&#5;?[...r(--a&#8;)&#8;(a)]:[],O&#5;&gt;&#16;&amp;b&gt;&#16;&amp;a&lt;w&amp;b&lt;&#15;g=&#17;&#8;,c,d&#11;&#16;&#18;(v(i&#19;&#17;+=c&#8;+=d&#11;&#14;O&#17;&#8;)?a[b][f]:!(e&#16;&#4;)&#11;),v=f&#19;r(w+&#15;s).some&#17;),n&#16;&#18;a&#1;(c,u&#18;c&#1;&#17;,z&#18;!f||!((M&#9;1])&#1;o&#19;M&#1;b&#19;(l&#2;b,o&#4;&#7;(N&#12;x=z,y&#6;(x&#14;y+=b,O(x,y)&#7;a[y][x]&amp;g(x,y&#8;,o)==l&#7;N++&#4;,n=s(n,N&#4;&#4;,m&#2;1,0&#4;||(d&#2;0,1),n&#9;0,k=1]&#1;p&#19;[!(d&#7;p),1]&#1;q&#19;(j&#12;t=z&#11;&#6;!(e&#14;t+=p,O(t&#11;)&#7;a[e][t]&amp;g(t&#11;,q,!q)==(q?m:d)&#7;++j&#4;,k=s(k,j&#3;k&#3;c&#7;f(r(w,g&#19;r(&#15;f&#19;a[f][g]&#4;,&#15;w,0&#4;';G=/[&#1;-&#19;]/.exec(_);)with(_.split(G))_=join(shift());eval(_)
  • </code></pre>
  • [Try it online!][TIO-kkogd170]
  • [JavaScript (Node.js)]: https://nodejs.org
  • [TIO-kkogd170]: https://tio.run/##bVLdcrIwEB0tLRQd/3gBvNHNsCLc1qa97FXbB0DGRgTUIiBQ/4Z3t6Hlw/abkmGye/bknN1M1mzHUidZxdkojBbu@exFCczokD4oROmB16VGZ4ltTcMWNbGJboNaIxNvcS4NBiL9wB2slBsKTOqxa0IEQRBTCPGK@nDCD6zrGxZDzeME3GPbaab0mWVLjh4wuX60dF1PYDRiEpGAEfvOsvH1@qEzmPOf3e8H8/u2T7sSOrhodHpQmHU16kgaXTRar12JPDJrbluefdcHtyOQBsEd9ZQE9lo7JXoabdwuwbDTYzVw8KPn1Lp46vW9PO8DPN@aNqlFynNtrkBQn2MkiPDSPNATHm/g0DpqdI6vcMAjEZl1tK2DPfCLVMKIUBqIL5omYEiLgV8EATd1Ew0hz2FRN9DktrcGvlPTrsWK1YeFGBPkyVaBdTOjp8YNb7mVaTTmHlmjsHBtKysssgZusb/lHrB93NwtiKhpa4FrpfCO66v3K0f0gM@IPp@07SmMX4Dl2wK297yB4eSJjq3aSLHHuntwHZiRCdmvsiXM9DQOVhk8ETKj62gVQrpceRkQMnF3LODE8@RNlg3V/FqGavC4WhVeVL4Kf5HKxJQvpy6nK4JZUszvWC73/8u/I/MPrIjki0ZpV3ZRQeZPYeOH7wWT3/QsWW2A6IkbB8xxYTxNpmE@TfJpOPZRHU7DISkvkMdfmayqxftmKn1QnShMo8DVg8iHb8Tjj15llmHrgRv62ZInZUQIsH92XENVK1kuWilWlLKq/iqquWqQ4pucPwE "JavaScript (Node.js) – Try It Online"
  • # [JavaScript (Node.js)], 541 bytes
  • <!-- language-all: lang-javascript -->
  • <pre><code>for(_='=&gt;&#20;)&#20;&#19;+=&#18;=0&#17;h,&#16;.map(&#15;&#20;M&#15;&#14;,R(&#12;=1,&#11;,e&#9;,b&#8;=[-1,&#7;&amp;&amp;&#6;=u,v(i&#20;&#5;))&#4;&#4;&#4;&#6;s(n,&#3;=(a&#8;&#19;a&#2;=g(z,u,&#1;f=(a,w,&#16;c&#11;s=Math.max,r&#2;?[...r(--a&#8;)&#8;(a)]:[],R&#2;&gt;&#17;&amp;b&gt;&#17;&amp;a&lt;w&amp;b&lt;&#16;g=(f&#8;,c,d&#9;&#17;&#19;(v(i&#20;(f&#18;c&#8;&#18;d&#9;++&#12;f&#8;)?a[b][f]:!(e&#17;&#4;)&#9;),v=f&#20;r(w+&#16;s).some(f),n&#17;&#19;a&#15;(c,u&#19;c&#15;(f,z&#19;!f||!((M&#7;1])&#15;o&#14;l&#14;N&#14;O&#20;(o-N||l-O)&amp;(o+N||l+O)&#6;(P&#1;o,l&#4;&#6;(Q&#11;x=z,y&#5;(x&#18;N,y&#18;O&#12;x,y)&#6;a[y][x]&amp;g(x,y,o,l)==P&#6;Q++&#4;,n=s(n,Q&#4;&#4;&#4;,m&#1;1,0&#4;||(d&#1;0,1),n&#7;0,k=1]&#15;p&#20;[!(d&#6;p),1]&#15;q&#20;(j&#11;t=z&#9;&#5;!(e++,t&#18;p&#12;t&#9;)&#6;a[e][t]&amp;g(t&#9;,q,!q)==(q?m:d)&#6;++j&#4;,k=s(k,j&#3;k&#3;c&#6;f(r(w,g&#20;r(&#16;f&#20;a[f][g]&#4;,&#16;w,0&#4;';G=/[&#1;-&#20;]/.exec(_);)with(_.split(G))_=join(shift());eval(_)
  • </code></pre>
  • [Try it online!][TIO-kkp2nxd9]
  • [JavaScript (Node.js)]: https://nodejs.org
  • [TIO-kkp2nxd9]: https://tio.run/##bVPLcqpAEC0TQnyVTz4AN9pTtAjbmEmWWSUm2SJlRgTUICAQX8W/ewfDNcm9YQrm9Jzuc2aamiXbsNiKFmHS94OZfTw6QQQT2qN3EpHaCm1RrTnHhrpiIdSlx3oNX6FKdaygXcJpkRp9Ha@7XZF@4AYW0hUhgiCIMfh4SYEV2@yCunDADyw4PMYtNqxKTB9ZMueSO4wu7g1VVSPo91mRFIER88Yw8fXirtmd8pfdbrvT24ZLwSmihbNSsw2ZDzgtq9ialRSl6hTJPTOmpuGYNx2wmwIpEdxQR4pgqzRiosbBygaHoN9sszpY@NG26uDgod1x0rQD8Hitm6Qe1LzaU20kQdB/SlOvPyJdCJQMKiMiwnMhQE8Q4aWyowfcX8Gu9YT71qi6wz0RmbE3jZ3ZdYGHyDMJpc/ii6II6NOsGS@8K7gq6KgJaQqzgoY639C1hu9UN@uhZHRgJoYEebCWYFlJ6KF0xU@jKJi0wmpSyjxs00gyj6SEa@ysuQes71c3MyIqylLgUjG84/Ly/dISHeCnR5f3oOFIjLfGcE0BG1vu3xs@0IFR6EvmQLV3tgUTMiTbRTKHiRqH3iKBB0ImdBksfIjnCycBQob2hnk88Ti0Aj8OPFv1AhfeymVN1k9DkzWOz@O8njEn4rekPNDLX1Vf1ecEPU/RP3E5n/@lfyL9l7UMlb80crt8F@cl/buw9s1X@9/3N5p7fE76N6fym5pEixUQNbJDj1k2DMbR2E/HUTr2By7KvbHfI3n7OT5FZVnObh2T6Z38@XX4DZKZoZmqZ/tuMudBjggB9teC18nyWYoLnVXOKTkr/yDlVNYIf9TTr89IMjz@AQ "JavaScript (Node.js) – Try It Online"
#4: Post edited by user avatar Hakerh400‭ · 2021-02-02T20:29:58Z (almost 4 years ago)
  • # [JavaScript (Node.js)], 534 bytes
  • <!-- language-all: lang-javascript -->
  • f=(a,w,h,c=1,s=Math.max,r=(a,b)=>a?[...r(--a,b),b(a)]:[],S=(a,b)=>a>=0&b>=0&a<w&b<h,g=(f,b,c,d,e=0)=>(v(i=>(f+=c,b+=d,e++,S(f,b)?a[b][f]:!(e=0))),e),v=f=>r(w+h,s).some(f),n=0)=>a.map((c,u)=>c.map((f,z)=>!f||!((A=[-1,1]).map(D=>A.map(b=>(F=g(z,u,b,D))&&(K=1,x=z,y=u,v(i=>(x++,y+=b,S(x,y)&&a[y][x]&g(x,y,b,D)==F&&K++)),n=s(n,K)))),m=g(z,u,1,0))||(d=g(z,u,0,1),n=[-1,0,k=1].map(p=>[!(d&&p),1].map(q=>(j=1,t=z,e=u,v(i=>!(e++,t+=p,S(t,e)&&a[e][t]&g(t,e,q,!q)==(q?m:d)&&++j)),k=s(k,j))))&&s(n,k))))&&s(n,c&&f(r(w,g=>r(h,f=>a[f][g])),h,w,0))
  • [Try it online!][TIO-kkog77le]
  • [JavaScript (Node.js)]: https://nodejs.org
  • [TIO-kkog77le]: https://tio.run/##bZPLbqswEIb3PIWzccZiQvE2rYkqVd1EZ9UlQaohXHIjBMhVvHvOmFBoqwoJ5vLP@GNsr/VJV1G5KupJvl/G93uiQOMZM4yUxEr903Xm7PQFSxMPhfL0zHccp4TJxPgYghbB1A/woxd4yuWheemXMw9fMkwVJBhihEuMlUsSOMGK3omtIgxtRWHbxg8jEjPth4GfBNMRGK0QGAs8qUR5JZztDCvhVPtdDInAvO2lCa8AiPBITvRwEryRM0qaZgTwqvyJRBmINvemvNfWCAngXaVwwyOxvQnBOczpny/qhld1xAfihcCutgqJ7oJX0mj/GviXgKfGbwuVeud8btvCEFWQ41wY7F3XWyL9RdPAsvNdlEZomFzcKBm0NIXy/BEsOS8EdqEDLb8moJqA4i8gmgoR1bYqiKim2RiiOPBrQ0Q@HnB0ICQ4zHbTJWVte00wGwLb4NqAcW4YN4MZcZ4ADZe2iWacIY1a0wb4aUCFGZ0F4r8/f1qWy2T7uMwlu3/6uMm0ib9EnSOtoWqo7gWyk8iHbXXf3@mflvwjZixr6NEt11H0Ifm9sftt3SFmfTp1udqBcMq42OoohqdFucibRdks8qcU2XiRj@lMFttVDWS3nsWY2UHNlMeifV7tt7Gz3afwiCR0UZj23cDZxnlaZ@R0lhCgv5ajHoz1bceP09vW95Iuy34kWcPMtRHi@f4f "JavaScript (Node.js) – Try It Online"
  • # [JavaScript (Node.js)], <del>534</del> 510 bytes
  • <!-- language-all: lang-javascript -->
  • <pre><code>for(_='=&gt;&#19;)&#19;&#18;(f&#17;=0&#16;h,&#15;++,&#14;=1,&#12;,e&#11;=[-1,&#9;,b&#8;&amp;&amp;&#7;=u,v(i&#19;&#6;=(a&#8;&#18;a&#5;))&#4;&#4;&#4;&#7;s(n,&#3;=g(z,u,&#2;.map(&#1;f=(a,w,&#15;c&#12;s=Math.max,r&#5;?[...r(--a&#8;)&#8;(a)]:[],O&#5;&gt;&#16;&amp;b&gt;&#16;&amp;a&lt;w&amp;b&lt;&#15;g=&#17;&#8;,c,d&#11;&#16;&#18;(v(i&#19;&#17;+=c&#8;+=d&#11;&#14;O&#17;&#8;)?a[b][f]:!(e&#16;&#4;)&#11;),v=f&#19;r(w+&#15;s).some&#17;),n&#16;&#18;a&#1;(c,u&#18;c&#1;&#17;,z&#18;!f||!((M&#9;1])&#1;o&#19;M&#1;b&#19;(l&#2;b,o&#4;&#7;(N&#12;x=z,y&#6;(x&#14;y+=b,O(x,y)&#7;a[y][x]&amp;g(x,y&#8;,o)==l&#7;N++&#4;,n=s(n,N&#4;&#4;,m&#2;1,0&#4;||(d&#2;0,1),n&#9;0,k=1]&#1;p&#19;[!(d&#7;p),1]&#1;q&#19;(j&#12;t=z&#11;&#6;!(e&#14;t+=p,O(t&#11;)&#7;a[e][t]&amp;g(t&#11;,q,!q)==(q?m:d)&#7;++j&#4;,k=s(k,j&#3;k&#3;c&#7;f(r(w,g&#19;r(&#15;f&#19;a[f][g]&#4;,&#15;w,0&#4;';G=/[&#1;-&#19;]/.exec(_);)with(_.split(G))_=join(shift());eval(_)
  • </code></pre>
  • [Try it online!][TIO-kkogd170]
  • [JavaScript (Node.js)]: https://nodejs.org
  • [TIO-kkogd170]: https://tio.run/##bVLdcrIwEB0tLRQd/3gBvNHNsCLc1qa97FXbB0DGRgTUIiBQ/4Z3t6Hlw/abkmGye/bknN1M1mzHUidZxdkojBbu@exFCczokD4oROmB16VGZ4ltTcMWNbGJboNaIxNvcS4NBiL9wB2slBsKTOqxa0IEQRBTCPGK@nDCD6zrGxZDzeME3GPbaab0mWVLjh4wuX60dF1PYDRiEpGAEfvOsvH1@qEzmPOf3e8H8/u2T7sSOrhodHpQmHU16kgaXTRar12JPDJrbluefdcHtyOQBsEd9ZQE9lo7JXoabdwuwbDTYzVw8KPn1Lp46vW9PO8DPN@aNqlFynNtrkBQn2MkiPDSPNATHm/g0DpqdI6vcMAjEZl1tK2DPfCLVMKIUBqIL5omYEiLgV8EATd1Ew0hz2FRN9DktrcGvlPTrsWK1YeFGBPkyVaBdTOjp8YNb7mVaTTmHlmjsHBtKysssgZusb/lHrB93NwtiKhpa4FrpfCO66v3K0f0gM@IPp@07SmMX4Dl2wK297yB4eSJjq3aSLHHuntwHZiRCdmvsiXM9DQOVhk8ETKj62gVQrpceRkQMnF3LODE8@RNlg3V/FqGavC4WhVeVL4Kf5HKxJQvpy6nK4JZUszvWC73/8u/I/MPrIjki0ZpV3ZRQeZPYeOH7wWT3/QsWW2A6IkbB8xxYTxNpmE@TfJpOPZRHU7DISkvkMdfmayqxftmKn1QnShMo8DVg8iHb8Tjj15llmHrgRv62ZInZUQIsH92XENVK1kuWilWlLKq/iqquWqQ4pucPwE "JavaScript (Node.js) – Try It Online"
#3: Post edited by user avatar Hakerh400‭ · 2021-02-02T20:24:55Z (almost 4 years ago)
  • # [JavaScript (Node.js)], 520 bytes
  • <!-- language-all: lang-javascript -->
  • f=(a,w,h,c=1,s=Math.max,r=(a,b)=>a?[...r(--a,b),b(a)]:[],S=(a,b)=>a>=0&b>=0&a<w&b<h,g=(f,b,c,d,e=0)=>(v(i=>(f+=c,b+=d,e++,S(f,b)?a[b][f]:!(e=0))),e),v=f=>r(w+h,s).some(f),n=0)=>a.map((c,u)=>c.map((f,z)=>!f||!([-1,1].map(b=>(F=g(z,u,b,1))&&(K=1,x=z,y=u,v(i=>(x++,y+=b,S(x,y)&&a[y][x]&g(x,y,b,1)==F&&K++)),n=s(n,K))),m=g(z,u,1,0))||(d=g(z,u,0,1),n=[-1,0,k=1].map(p=>[!(d&&p),1].map(q=>(j=1,t=z,e=u,v(i=>!(e++,t+=p,S(t,e)&&a[e][t]&g(t,e,q,!q)==(q?m:d)&&++j)),k=s(k,j))))&&s(n,k))))&&s(n,c&&f(r(w,g=>r(h,f=>a[f][g])),h,w,0))
  • [Try it online!][TIO-kkofkmnl]
  • [JavaScript (Node.js)]: https://nodejs.org
  • [TIO-kkofkmnl]: https://tio.run/##bZPLboMwEEX3fIWzccfyhMI2rZNdN1FXXTpINe@8CAHyFP@ejgkhalUhwdyZ6/FhDCtzNHVULctmXOzi5HZLFRg8YY6R8rFWn6bJ3a05Y2XzoVBTM9Ou61YwHluNIRgRTHSAX4Nhqjwe2pt5P/HwPcdMQYohRhhjojyywBGWdE@lijCUitJS4pc1iZnRYaDTYDIC6xUCE4FHlappBSeZYy3cerdNIBVYdL0M4ZUAER5IRHeR4pXEKG3bEeixj37Q5UPa80NlcMUD4fhCcA5zes2zuuJFHfBOdSaWi1QhAZ3xQh6jL4E@Bzyzuluo1AfncymFhaihwLkF3fatfSTutoW41x6tIJ8F8XCtephSTfUIYs5L8eDb0@4r4mmIJ3nw0BwIqJGqJKCGpmGBkkA3Fog07nG0JyLYz7aTmKpSrghmTVxrpMi@pUVcP8OI8xRonHQwNNUcabiGRq6zgBbmdPrEf3v7dhyP@d3lMY/i4RryttIV/jP1wneeq56rB4PfW/x77PTPv@Xfkf9PzkbOs0e/XU8xpGzZ@XabarkF4VZJuTFRAq@LalG0i6pdFK8ZspdF8UKfWblZNkBxpxzG7BEZpqYs2hX1bpO4m10G90xK3z4z2gvcTVJkTU6ij4QA89iOejA2tKWmQ8fB0lfZryJrmf0ThHi7/QA "JavaScript (Node.js) – Try It Online"
  • # [JavaScript (Node.js)], 534 bytes
  • <!-- language-all: lang-javascript -->
  • f=(a,w,h,c=1,s=Math.max,r=(a,b)=>a?[...r(--a,b),b(a)]:[],S=(a,b)=>a>=0&b>=0&a<w&b<h,g=(f,b,c,d,e=0)=>(v(i=>(f+=c,b+=d,e++,S(f,b)?a[b][f]:!(e=0))),e),v=f=>r(w+h,s).some(f),n=0)=>a.map((c,u)=>c.map((f,z)=>!f||!((A=[-1,1]).map(D=>A.map(b=>(F=g(z,u,b,D))&&(K=1,x=z,y=u,v(i=>(x++,y+=b,S(x,y)&&a[y][x]&g(x,y,b,D)==F&&K++)),n=s(n,K)))),m=g(z,u,1,0))||(d=g(z,u,0,1),n=[-1,0,k=1].map(p=>[!(d&&p),1].map(q=>(j=1,t=z,e=u,v(i=>!(e++,t+=p,S(t,e)&&a[e][t]&g(t,e,q,!q)==(q?m:d)&&++j)),k=s(k,j))))&&s(n,k))))&&s(n,c&&f(r(w,g=>r(h,f=>a[f][g])),h,w,0))
  • [Try it online!][TIO-kkog77le]
  • [JavaScript (Node.js)]: https://nodejs.org
  • [TIO-kkog77le]: https://tio.run/##bZPLbqswEIb3PIWzccZiQvE2rYkqVd1EZ9UlQaohXHIjBMhVvHvOmFBoqwoJ5vLP@GNsr/VJV1G5KupJvl/G93uiQOMZM4yUxEr903Xm7PQFSxMPhfL0zHccp4TJxPgYghbB1A/woxd4yuWheemXMw9fMkwVJBhihEuMlUsSOMGK3omtIgxtRWHbxg8jEjPth4GfBNMRGK0QGAs8qUR5JZztDCvhVPtdDInAvO2lCa8AiPBITvRwEryRM0qaZgTwqvyJRBmINvemvNfWCAngXaVwwyOxvQnBOczpny/qhld1xAfihcCutgqJ7oJX0mj/GviXgKfGbwuVeud8btvCEFWQ41wY7F3XWyL9RdPAsvNdlEZomFzcKBm0NIXy/BEsOS8EdqEDLb8moJqA4i8gmgoR1bYqiKim2RiiOPBrQ0Q@HnB0ICQ4zHbTJWVte00wGwLb4NqAcW4YN4MZcZ4ADZe2iWacIY1a0wb4aUCFGZ0F4r8/f1qWy2T7uMwlu3/6uMm0ib9EnSOtoWqo7gWyk8iHbXXf3@mflvwjZixr6NEt11H0Ifm9sftt3SFmfTp1udqBcMq42OoohqdFucibRdks8qcU2XiRj@lMFttVDWS3nsWY2UHNlMeifV7tt7Gz3afwiCR0UZj23cDZxnlaZ@R0lhCgv5ajHoz1bceP09vW95Iuy34kWcPMtRHi@f4f "JavaScript (Node.js) – Try It Online"
#2: Post edited by user avatar Hakerh400‭ · 2021-02-02T20:07:30Z (almost 4 years ago)
  • # [JavaScript (Node.js)], 388 bytes
  • <!-- language-all: lang-javascript -->
  • f=(a,w,h,c=1,s=Math.max,r=(a,b)=>a?[...r(--a,b),b(a)]:[],v=f=>r(w+h,s).some(f),n=0)=>a.map((c,u)=>c.map((f,z)=>!f|!(m=(g=(f,b,c,d,e=0)=>(v(i=>(f+=c,b+=d,e++,f<w&b<h?a[b][f]:!(e=0))),e))(z,u,1,0))||(d=g(z,u,0,1),n=[-1,0,k=1].map(p=>[!(d&&p),1].map(q=>(j=1,t=z,e=u,v(i=>!(e++,t+=p,t<w&e<h&&a[e][t]&g(t,e,q,!q)==(q?m:d)&&++j)),k=s(k,j))))&&s(n,k))))&&s(n,c&&f(r(w,g=>r(h,f=>a[f][g])),h,w,0))
  • [Try it online!][TIO-kko906sl]
  • [JavaScript (Node.js)]: https://nodejs.org
  • [TIO-kko906sl]: https://tio.run/##bVJbbqswEP1nFebHHYsJhd80TlbQFRikGmIgCa8ASaqIvadjwiXqVWXJnHPm6WGO@qr7tDu0w6pu9ubxyCRovGGBqQyxl596KPxKf2Nn9UTIrd4p3/c7WK0sxwS0iNcqxqvM5LaDm1dgL/y@qQxkAmsZ2BhK0QKkeCGSPkmGdyJuNrpQScglCQmmuEczhcAVDnRnnkwx8STJnofZ5saTTbHTKolVFq9dsM5CoBEC7njBEImOI@xlPvEAQ9uDWpEBTzKMp9qt3CoX9py3AmfpTLWO9OJB3qmBC07VKT0VHTzZ4kCVzabgXCsTqyHmOQxo8IzuWUgJ51213gvOPe9I3ZxkDyckJEjqocbTC6acZ0BjwtxOq0AamqanqDymwIImTw94fHw5TsDC6QQsILycRbeWyfCX00xC5xX1il4cwtklfGJn/v5v/o3CPzSLnC9/6A4VCL8zbalTA@9RF9Vj1I1R/Z4je4vqN1qMtjwMQHhiDmN2@prJLUubum9K45dNDk8lo5VjWgWxX5o6HwoiM6Lfrf@VoxyMLWkp6ZJxcZmt7JeRjczujhAfjx8 "JavaScript (Node.js) – Try It Online"
  • # [JavaScript (Node.js)], 520 bytes
  • <!-- language-all: lang-javascript -->
  • f=(a,w,h,c=1,s=Math.max,r=(a,b)=>a?[...r(--a,b),b(a)]:[],S=(a,b)=>a>=0&b>=0&a<w&b<h,g=(f,b,c,d,e=0)=>(v(i=>(f+=c,b+=d,e++,S(f,b)?a[b][f]:!(e=0))),e),v=f=>r(w+h,s).some(f),n=0)=>a.map((c,u)=>c.map((f,z)=>!f||!([-1,1].map(b=>(F=g(z,u,b,1))&&(K=1,x=z,y=u,v(i=>(x++,y+=b,S(x,y)&&a[y][x]&g(x,y,b,1)==F&&K++)),n=s(n,K))),m=g(z,u,1,0))||(d=g(z,u,0,1),n=[-1,0,k=1].map(p=>[!(d&&p),1].map(q=>(j=1,t=z,e=u,v(i=>!(e++,t+=p,S(t,e)&&a[e][t]&g(t,e,q,!q)==(q?m:d)&&++j)),k=s(k,j))))&&s(n,k))))&&s(n,c&&f(r(w,g=>r(h,f=>a[f][g])),h,w,0))
  • [Try it online!][TIO-kkofkmnl]
  • [JavaScript (Node.js)]: https://nodejs.org
  • [TIO-kkofkmnl]: https://tio.run/##bZPLboMwEEX3fIWzccfyhMI2rZNdN1FXXTpINe@8CAHyFP@ejgkhalUhwdyZ6/FhDCtzNHVULctmXOzi5HZLFRg8YY6R8rFWn6bJ3a05Y2XzoVBTM9Ou61YwHluNIRgRTHSAX4Nhqjwe2pt5P/HwPcdMQYohRhhjojyywBGWdE@lijCUitJS4pc1iZnRYaDTYDIC6xUCE4FHlappBSeZYy3cerdNIBVYdL0M4ZUAER5IRHeR4pXEKG3bEeixj37Q5UPa80NlcMUD4fhCcA5zes2zuuJFHfBOdSaWi1QhAZ3xQh6jL4E@Bzyzuluo1AfncymFhaihwLkF3fatfSTutoW41x6tIJ8F8XCtephSTfUIYs5L8eDb0@4r4mmIJ3nw0BwIqJGqJKCGpmGBkkA3Fog07nG0JyLYz7aTmKpSrghmTVxrpMi@pUVcP8OI8xRonHQwNNUcabiGRq6zgBbmdPrEf3v7dhyP@d3lMY/i4RryttIV/jP1wneeq56rB4PfW/x77PTPv@Xfkf9PzkbOs0e/XU8xpGzZ@XabarkF4VZJuTFRAq@LalG0i6pdFK8ZspdF8UKfWblZNkBxpxzG7BEZpqYs2hX1bpO4m10G90xK3z4z2gvcTVJkTU6ij4QA89iOejA2tKWmQ8fB0lfZryJrmf0ThHi7/QA "JavaScript (Node.js) – Try It Online"
#1: Initial revision by user avatar Hakerh400‭ · 2021-02-02T17:04:15Z (almost 4 years ago)
# [JavaScript (Node.js)], 388 bytes

<!-- language-all: lang-javascript -->

    f=(a,w,h,c=1,s=Math.max,r=(a,b)=>a?[...r(--a,b),b(a)]:[],v=f=>r(w+h,s).some(f),n=0)=>a.map((c,u)=>c.map((f,z)=>!f|!(m=(g=(f,b,c,d,e=0)=>(v(i=>(f+=c,b+=d,e++,f<w&b<h?a[b][f]:!(e=0))),e))(z,u,1,0))||(d=g(z,u,0,1),n=[-1,0,k=1].map(p=>[!(d&&p),1].map(q=>(j=1,t=z,e=u,v(i=>!(e++,t+=p,t<w&e<h&&a[e][t]&g(t,e,q,!q)==(q?m:d)&&++j)),k=s(k,j))))&&s(n,k))))&&s(n,c&&f(r(w,g=>r(h,f=>a[f][g])),h,w,0))

[Try it online!][TIO-kko906sl]

[JavaScript (Node.js)]: https://nodejs.org
[TIO-kko906sl]: https://tio.run/##bVJbbqswEP1nFebHHYsJhd80TlbQFRikGmIgCa8ASaqIvadjwiXqVWXJnHPm6WGO@qr7tDu0w6pu9ubxyCRovGGBqQyxl596KPxKf2Nn9UTIrd4p3/c7WK0sxwS0iNcqxqvM5LaDm1dgL/y@qQxkAmsZ2BhK0QKkeCGSPkmGdyJuNrpQScglCQmmuEczhcAVDnRnnkwx8STJnofZ5saTTbHTKolVFq9dsM5CoBEC7njBEImOI@xlPvEAQ9uDWpEBTzKMp9qt3CoX9py3AmfpTLWO9OJB3qmBC07VKT0VHTzZ4kCVzabgXCsTqyHmOQxo8IzuWUgJ51213gvOPe9I3ZxkDyckJEjqocbTC6acZ0BjwtxOq0AamqanqDymwIImTw94fHw5TsDC6QQsILycRbeWyfCX00xC5xX1il4cwtklfGJn/v5v/o3CPzSLnC9/6A4VCL8zbalTA@9RF9Vj1I1R/Z4je4vqN1qMtjwMQHhiDmN2@prJLUubum9K45dNDk8lo5VjWgWxX5o6HwoiM6Lfrf@VoxyMLWkp6ZJxcZmt7JeRjczujhAfjx8 "JavaScript (Node.js) – Try It Online"