Skip to content

Instantly share code, notes, and snippets.

@carlosefr
Last active March 25, 2019 19:59
Show Gist options
  • Save carlosefr/dbd4557f47e49e5c5de4802bf05dc555 to your computer and use it in GitHub Desktop.
Save carlosefr/dbd4557f47e49e5c5de4802bf05dc555 to your computer and use it in GitHub Desktop.
First correct answer to the "No Wires" challenge
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};
@carlosefr
Copy link
Author

This is jcazevedo's first accepted answer to the Pixels Camp Quizshow qualifiers' No Wires challenge, with just 419 bytes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment