Golfscript 260 chars
I'm sure this could be improved, I'm kind of new to Golfscript.
[39 26.2/0:$14{.(}:?~1?15?1?14 2??27?13.!14?2?27?14 1]4/:t;n/)\n*:|;' '/-1%.,:c;~{)18+:&;'XIOZTLSJX'\%~;,1-t\={{.&+.90>{;.}*|\=32=!{&13-:&;}*}%}6*{&+}/|{\.@<'#'+\)|>+}4*{'['\10*']'++}:
;n/0\~n+:|;0\{.'#'
={;)}{n+|+:|;}if\.}do;' '
n+\.@*|+\$+:$;.,1-<:|;}c*|n?$*
End of lines are relevant (there shouldn't be one at the end). Anyway, here are some of the test cases I used:
> cat init.txt
[ ]
[ ]
[ ]
[ ]
[ # # #]
[ ## ######]
[==========]
T2 Z6 I0 T7> cat init.txt | ruby golfscript.rb tetris.gsc
[ ]
[ ]
[ ]
[# ###]
[# ### ]
[##### ####]
[==========]
10
> cat init.txt
[ ]
[ ]
[ ]
[ ]
[ # # #]
[ ## ##### ]
[==========]
I0 O7 Z1 S4> cat init.txt | ruby golfscript.rb tetris.gsc
[ ]
[ ]
[ ]
[# ]
[### #### ]
[### ##### ]
[==========]
10
> cat init.txt
[ ]
[ ]
[ ]
[ ## ### ]
[ # # ]
[ ## ######]
[==========]
T7 I0 I3> cat init.txt | ruby golfscript.rb tetris.gsc
[ ]
[ ]
[ ]
[ ]
[# # ]
[## # # # ]
[==========]
20
Note that there is no end of line in the input file, an end of line would break the script as is.