Last active
March 25, 2019 19:59
-
-
Save carlosefr/dbd4557f47e49e5c5de4802bf05dc555 to your computer and use it in GitHub Desktop.
First correct answer to the "No Wires" challenge
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function f(a){a=a.split("\n");for(var g=a.length,e=a[0].length,l=[[-1,-1],[-1,0],[-1,1],[0,1],[1,1],[1,0],[1,-1],[0,-1]],b="",d=0;d<g;d++){for(var h=0;h<e;h++){var c=a[d].length<e?" ":a[d][h];if(" "==c)b+=" ";else if("H"==c)b+="t";else if("t"==c)b+=".";else if("."==c){for(var k=c=0;8>k;k++){var m=(d+g+l[k][0])%g;"H"==(a[m].length<e?" ":a[m][(h+e+l[k][1])%e])&&c++}b=1<=c&&2>=c?b+"H":b+"."}}d+1<g&&(b+="\n")}return b}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is jcazevedo's first accepted answer to the Pixels Camp Quizshow qualifiers' No Wires challenge, with just 419 bytes.