Spent a day with beautiful Python. Breath of fresh air
[8, 0, 0, 0, 0, 0, 0, 0][1, 1, 0, 0, 8, 0, 0, 0][1, 0, 1, 1, 1, 1, 0, 8][1, 0, 1, 1, 1, 8, 1, 1][1, 1, 8, 0, 1, 1, 1, 1][1, 1, 1, 1, 1, 1, 8, 1][1, 8, 1, 1, 1, 1, 1, 1][1, 1, 1, 8, 1, 1, 1, 1]113 iterations got this 8queens solution (It actually finds a solution to a 10queens problem in a shorter time)def array(x):. y=0. X=xrange. for a in x:y=[y for _ in X(a)]. return ydef echo(x):return map(echo,x) if type(x[0])==list else x[:]def plist(x):. if type(x[0])==list:map(plist,x). else:print xZ=0def solve(x,y=0):. global Z. Z+=1. if y==len(x):return x. for a in xrange(len(x[0])):. . if not x[y][a]:. . . X=echo(x). . . X[y][a]=8. . . for b in xrange(y+1,len(X)):. . . . X[b][a]=1. . . . if a+(b-y)<len(X[0]):X[b][a+(b-y)]=1. . . . if a-(b-y)>-1:X[b][a-(b-y)]=1. . . s=solve(X,y+1). . . if s:return splist(solve(array([8,8])))print ZI need to learn to not always do depthfirstThinking of trying it with more than 2DSpent some time working with array() as a substitute for the bugged [[0]*8]*8. A one liner with reduce was half a second slower with 10000 trials of array(range(10)) and X=xrange decreases time to 95%I'll be adding echo, array and plist to antigravity[quote=Anyways, I'm still brewing over the message I shot off weeks ago. Something really resonated with me, probably because the source was of a book which resonated with me]I'm sick of being told I'm going to amount to something or nothing. It all seems so mixed like people don't know what to thinkNow then, have an NxN queen iteration count list. Kinda neat how it goes up and down. No recursion max is going to be hit, since the stack is always below N0 01 12 23 54 85 56 317 98 1139 4110 10211 5212 26113 11114 189915 135916 1005217 537418 4129919 254520 19963521 856222 173718823 2542824 41160825 4868326 39769927 45421328 300629829 1532239