2-dimensional ray tracing The challenge is to implement a 2-dimensional ray tracing program, text-based.

Sources of white light are @ symbols. R, G and B are light filters. / and \ are mirrors with 80% reflectivity. ? is a light sensor. &gt;, &lt;, ^ and V combine light in the appropriate direction (e.g. if one red and one green came into a &gt; the light would be emitted toward the right and it would be yellow). Other non-whitespace characters absorb all light. Light is emitted from @ symbols in four directions.

When the program is run, it should produce output the same as the input, but with traced rays. Because this is 2 dimensional, and I guarantee in the input no rays will ever cross, there will be no problem with that. Each ray should be represented by a letter; r=red, g=green, b=blue, c=cyan, m=magenta, y=yellow, w=white. There won't be any ternary colors, ever. The casing is important to differentiate it from the input. After that output, the values of light captured by the question marks (in order of their appearance, left to right top to bottom) should be outputted as percentages and colors. For example, this input:

 /                  @
                    -
 \R&gt;                 ?

 @B/


Should give the output:

 /wwwwwwwwwwwwwwwwww@w
 w                  -
w\R&gt;mmmmmmmmmmmmmmmmm?
 w b
 @B/

#1: 72% Magenta


Another important point to note - when two colors are combined using a "prism" (the arrows) the strength of the combined light becomes the average strength of the two. Output must be exactly as specified (e.g. #x: [x][x]x% Color).

If your language cannot read from STDIN and write to STDOUT, create a function (anonymous or lambda when available) that accepts the input as an argument and returns the result.

Directives to the compiler, structures required or recommended for all or most programs created in the language, etc. can be omitted. For example, #include and using directives (but not #define) may be removed in C-style languages, #/usr/bin/perl -options in Perl, and

 Module Module1
      Sub Main()
      End Sub
 End Module


in VB.NET, for example. If you import namespaces or add include directives, please note them in your answer.

Is that hard enough, now? :)
Python, 602 559 614 chars

import sys
S=sys.stdin.readlines()
X=max(len(s)for s in S)
I='#'*X+''.join(t[:-1]+' '*(X-len(t))+'\n'for t in S)+'#'*X
L=len(I)
R=range(L)
B=[0]*L
C=[0]*L
for p in R:
 if'@'!=I[p]:continue
 for d in(1,-1,X,-X):
  q=p;c=7;b=100.
  while 1:
   q+=d;a=I[q];B[q]+=b;C[q]|=c
   if a in'\/':d=(ord(a)/30-2)*X/d;b*=.8
   elif a in'RGB':c&amp;=ord(a)/5-12
   elif a in'&gt;&lt;^V':d={'&gt;':1,'&lt;':-1,'^':-X,'V':X}[a];b/=2
   elif' '!=a:break
print''.join(I[p]if' '!=I[p]else' bgcrmyw'[C[p]]for p in R[X:-X])
i=0
for p in R:
 if'?'==I[p]:i+=1;print'#%d:'%i,'%.0f%%'%B[p],[0,'Blue','Green','Cyan','Red','Magenta','Yellow','White'][C[p]]


Edit: fixed so it doesn't need trailing spaces.