Skip to content

Instantly share code, notes, and snippets.

@shiv3
Last active May 25, 2017 13:49
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 shiv3/c115de7b75c448e12bcce87950d86379 to your computer and use it in GitHub Desktop.
Save shiv3/c115de7b75c448e12bcce87950d86379 to your computer and use it in GitHub Desktop.
########
# #
# #### #
# # # #
# # # #
# # ## #
# # #
# ######
n=8;a="";for(i=m=0;i<n;++i){for(j=0;j<n;++j){mark=!1;for(k=0;k<=m;k+=2)if((i==k||j==k||i==n-1-k||j==n-1-k)&&i>=k&&j>=k&&i<n-k&&j<n-k){mark=!0;break}if(j==n-i&&(j<n-n/2-n%2+(0==n%4?0:1)||i>n-n/2)||1==j&&i==n-1)mark=1==mark?!1:!0;a+=mark?"#":" "}a+="\n";0==i%2&&(m+=2)}console.log(a);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment