football league standings by yvl

i=0
$_=$<.map{|$_|c=[0]*9
c[0],*a=split
a.map{|b|{1,1,2,"\x01\x00\x03"[d=0<=>f=eval(b)],4+d,1,6,e=b.to_i,7,e-f,8,f}.map{|k,v|c[k]+=v}}
[-c[2],-c[8],-c[6],c]}.sort.map{|a|"#{i+=1} %s#{'%3s'*7}%+4d"%a[3]}*$/
puts"%#{~/$/}s"%"P Pt  W  D  L  F  A  GD",sub("+0"," 0")

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

download

return to the top page