Skip to content

Instantly share code, notes, and snippets.

@kpmiller
Last active December 29, 2020 18:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kpmiller/3e3319dd120e79d7a5e0e43b0ca86a01 to your computer and use it in GitHub Desktop.
Save kpmiller/3e3319dd120e79d7a5e0e43b0ca86a01 to your computer and use it in GitHub Desktop.
javascript to convert the current puzzle to Simple Sudoku (.ss) format from ironsudoku.com
ga=master_string.split(',');
gg="";
for (j=0;j<81;j++){
if (ga[j]=="")gg=gg+".";
else gg=gg+ga[j];
if (j==0) continue;
else if (j==80) break;
else if (j%27==26) gg=gg+"\n---+---+---\n";
else if (j%9==8) gg=gg+"\n";
else if (j%3==2) gg=gg + "|";
}
alert(gg);
//bookmarklet:
javascript:(function()%7Bga%3Dmaster_string.split('%2C')%3B%0Agg%3D%22%22%3B%0Afor%20(j%3D0%3Bj%3C81%3Bj%2B%2B)%7B%0Aif%20(ga%5Bj%5D%3D%3D%22%22)gg%3Dgg%2B%22.%22%3B%0Aelse%20gg%3Dgg%2Bga%5Bj%5D%3B%0Aif%20(j%3D%3D0)%20continue%3B%0Aelse%20if%20(j%3D%3D80)%20break%3B%0Aelse%20if%20(j%2527%3D%3D26)%20gg%3Dgg%2B%22%5Cn---%2B---%2B---%5Cn%22%3B%0Aelse%20if%20(j%259%3D%3D8)%20gg%3Dgg%2B%22%5Cn%22%3B%0Aelse%20if%20(j%253%3D%3D2)%20gg%3Dgg%20%2B%20%22%7C%22%3B%0A%7D%0Aalert(gg)%3B%7D)()%3B
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment