Monday, August 15, 2011

tcl example coputing points per shot for pistol pete

http://www.basketballreference.com/players/playerpage.htm?ilkid=MARAVPE02
$ tclsh8.6
>set p " paste blah from above regular season stats "
>set z [split $p "\n"]
>foreach x $z {
set points [lindex $x 6]
set fga [lindex $x 9]
set fta [lindex $x 12]
set eff [expr {$points / [expr {$fga + [expr {$fta / 2.0}]}]}]
puts "[lindex $x 0] [format "%.2f" $eff]"
}
1970-71 1.01
1971-72 0.98
1972-73 0.99
1973-74 1.02
1974-75 0.94
1975-76 1.03
1976-77 0.97
1977-78 0.97
1978-79 0.94
1979-80 0.91
1979-80 1.08
1979-80 0.99

No comments: