[Influence of Chess Pieces] [1] It's been awhile since I last wrote about this program [2], and in the time since it's seen a bit of work (it hasn't been a real high priority as you can tell). The color scheme has changed a bit since I last wrote, with green denoting white's influence over the board, and a red border now showing conflicting influence; the squares that are both blue and green show what percentage of influence each side has. I also highlight the movement of the piece that's under the mouse cursor (here the mouse was over the white bishop in the penultimate row) although sometimes it's somewhat hard to tell (without using totally garish colors).
On the chessboard shown [3], the black king is in check (easily seen since it's on a contested square) by the white bishop, which itself is in a contested square. The two gray squares in the top middle of the board are not under the influence of either side, even though the two white pawns can easily move into those squares, which leads me to the next thing I've discovered as I've been working on this: the pawns are the hardest to deal with.
Pawns move straight in one direction, but capture on the diagonal (except for en passant which I don't even want to deal with at this point) so calculating the influence of a pawn over the board isn't quite that easy, but I think I got it down.
I think.
And yes, I do need to rotate the board clockwise to match the orientation used in chess documentation.
[1] /boston/2005/05/31/chessboard.gif