Help Sam understand chess
Ruby, 125
anonymous function, prints to stdout.
RevB: golfed, but a bug fix brought it back to the same length as before.
-&gt;x,y,z{72.times{|i|v=y-i/9;u=x-i%=9
e=u*u+v*v
$&gt;&lt;&lt;(i&lt;8?e&lt;1?z:[r=0==v*u,b=u*u==v*v,b|r,3&gt;e,5==e][&quot;RBQKN&quot;=~/#{z}/]??*:?.:$/)}}

Prints each of the 64 squares + 8 newlines = 72 characters individually.
Relies on e, the square of the Euclidean distance between the current square and the given coordinates for checking king moves and knight moves (and also for printing the piece value z when the Euclidean distance is zero.)
Ungolfed in test program
f=-&gt;x,y,z{                         #x,y,character
  72.times{|i|                     #8 rows of (8 chars + newline) = 72 chars
    v=y-i/9;                       #vertical diff between y coord and current square
    u=x-i%=9                       #horizontal diff between x coord and current square. note i%=8
    e=u*u+v*v                      #square of euclidean distance
    $&gt;&lt;&lt;(                          #$&gt; is stdout. send to it....
      i&lt;8?                         #if not the newline column,
        e&lt;1?z:                       #if the euclidean distance is 0, print the symbol for the piece, else
        [r=0==v*u,                   #TRUE if v or u is 0 (rook)
        b=u*u==v*v,                  #TRUE if abs(u)==abs(v) (bishop)
        b|r,                         #TRUE if either of the above are true (queen)
        3&gt;e,                         #TRUE if e == 1 or 2 (king)
        5==e                         #TRUE if e == 5 (knight)
        ][&quot;RBQKN&quot;=~/#{z}/]??*:?.:    #select value from array corresponding to piece and print * or . accordingly
      $/                           #if newline column, print a newline
    )
  }
}

x=gets.to_i
y=gets.to_i
z=gets.chomp
f[x,y,z]