-
-
Save yosun/b21d82c1f97af8d3a0fa to your computer and use it in GitHub Desktop.
spiral golf in 181 chars
This file contains 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
n,r,c=31,range,'x ' | |
s=map(r,[n]*n) | |
def f(x): | |
q=r(x,n-x) | |
for i in q: | |
for j in q:s[i][j]=c[x%2] | |
for i in r(0,n/2,2):f(i),f(i+1);s[i+2][i+1],s[i+1][i]=c | |
for r in s:print' '.join(r) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment