football league standings by yowa

t=i=0
o=ARGF.map{|z|t,*a=z.split
k=[x=y=0]*3
a.map{|s|x+=c=s[0]%8
y+=d=s[2]%8
k[d<=>c]+=1}
f,g,e=k
[-n=e*3+f,y-x,-x,[t,a.size,n,e,f,g,x,y,x-y]]}
puts"#{' '*t.size}    P Pt  W  D  L  F  A  GD"
o.sort.map{|a|puts(("#{i+=1} %s#{'%3d'*7}%+4d"%a[3]).sub'+0',' 0')}

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return top