Difference between revisions of "Eth1winter pygame vexocide"
From Eth0Wiki
(New page: == VeXocide's entry (238 chars, score 305) == <pre> def AreaMax(i): s=0 for z in range(1,196): v,w=z%14,z/14 t=sum(v*pow(-1,v%2==1) for v in [[map(int,z.split()) for z in i.split('\n...) |
(No difference)
|
Latest revision as of 20:14, 31 January 2009
VeXocide's entry (238 chars, score 305)
def AreaMax(i): s=0 for z in range(1,196): v,w=z%14,z/14 t=sum(v*pow(-1,v%2==1) for v in [[map(int,z.split()) for z in i.split('\n')[::-1]][y][x] for x,y in [(v+x%3-1,w+x/3-1) for x in range(9) if x!=4]]) if t>s:s,c=t,(v+1,w+1) return s,c
Edited after the compo, more readable somewhat shorter (233 chars, score 311)
def AreaMax(i,m=0): for n in range(196): v,w=n%14,n/14 t=sum(s*(1,-1)[s&1] for s in [[map(int,z.split()) for z in i.split('\n')[::-1]][y][x] for x,y in [(v+x%3-1,w+x/3-1) for x in range(9) if x!=4]]) if t>m:m,c=t,(v+1,w+1) return m,c