Python 2.6, 886 - 1425 characters
My initial version (in the revisions) came in at 886 characters but did not satisfy the spec completely (it did not check for avoiding checkmate ; it didn't even consider the possible moves of the black pieces).
Now it does (and I've fixed several bugs in the original). Alas this comes with a cost in characters: 1425 for now, but there should still be little room for improvement. This version should be a lot more solid in handling edge cases then the previous one.
#-*-coding:utf8-*- import sys;e=enumerate B,W=["♟","♜","♞","♝","♛","♚"],["♙","♖","♘","♗","♕","♔"] R={"♙":[11,42],"♖":[28],"♘":[31],"♗":[8],"♕":[8,28],"♔":[1,21]} def F(w):return sum([[(i,j)for j,p in e(o)if p==w]for i,o in e(Z)],[]) def G(x,y): P=Z[x][y];D=P in W;L=[] for o in R[P]if D else R[unichr(ord(P.decode('utf8'))-6).encode('utf8')]: r,k="%02d"%o for g,h in[[(-1,-1),(1,1),(-1,1),(1,-1)],[[(1,-1),(1,1)],[(-1,-1),(-1,1)]][D],[(-1,0),(1,0),(0,-1),(0,1)],[(-2,-1),(-2,1),(-1,-2),(-1,2),(1,-2),(1,2),(2,-1),(2,1)],[(-1,0)]][int(r)]: J=0 for i in range(int(k)): T=x+(i+1)*g;U=y+(i+1)*h if T<0 or T>7 or U<0 or U>7:break M=Z[T][U] if not J:L.append((T,U,P,M)) else:break if r in"02"and(M in W+B): J=1 if not((D and M in B)or(not D and M in W)):L.pop() elif(r=="1"and not((D and M in B)or(not D and M in W)))or(r=="4"and((i==1 and x!=6)or M!="…")):L.pop() return L Z=[[y for y in l[5:].split()]for l in sys.stdin.readlines()[:-2]] Q=[] for p in R: for i,j in F(p): for M,L,c,_ in G(i,j): O=Z[M][L];Z[i][j]="…";Z[M][L]=c;E=[];map(E.extend,map(F,B)) if not any(any(1 for _,_,_,I in G(v,h)if I==["♔","♚"][c in B])for v,h in E):Q.append((i,j,M,L,c)) Z[i][j]=c;Z[M][L]=O (x,y,X,Y,p)=Q[0];Z[x][y]="…";Z[X][Y]=p for i,h in e(Z):print`8-i`+' ║'+' '.join(h) print"——╚"+"═"*16+"\n—— a b c d e f g h"
Example input and output:
# INPUT 8 ║♜ ♞ ♝ … ♚ ♝ ♞ ♜ 7 ║♟ ♟ ♟ ♟ … ♟ ♟ ♟ 6 ║… … … … … … … … 5 ║… … … … ♟ … … … 4 ║… … … … … … ♙ ♛ 3 ║… … … … … ♙ … … 2 ║♙ ♙ ♙ ♙ ♙ … ♙ … 1 ║♖ ♘ ♗ ♕ ♔ ♗ ♘ ♖ ——╚═══════════════ —— a b c d e f g h
# OUTPUT 8 ║♜ ♞ ♝ … ♚ ♝ ♞ ♜ 7 ║♟ ♟ ♟ ♟ … ♟ ♟ ♟ 6 ║… … … … … … … … 5 ║… … … … ♟ … … … 4 ║… … … … … … ♙ ♛ 3 ║… … … … … ♙ ♙ … 2 ║♙ ♙ ♙ ♙ ♙ … … … 1 ║♖ ♘ ♗ ♕ ♔ ♗ ♘ ♖ ——╚════════════════ —— a b c d e f g h