Gaze of Death – Kings may not face each other directly without an intervening piece
and I have this thing through to the point that it will read a FEN (a notation describing a board state, like
), create a board recording that, work out the valid moves for each piece (that is, the squares that that piece can move to), then work out what moves are ‘allowed’ – that is, the move doesn’t result in check, or causing the Gaze of Death.
I’ve used bit boards for most of it, but I haven’t precomputed them, as has been the case for some chess engines. The reason, mainly, was being unsure how to cope with ‘Blocking’ rules – that is, some pieces can be blocked by a piece up close to them. For example, Knights can’t jump – they move 1 square straight, and another diagonally. If there is a piece on the straight square, they can’t move that way.
I couldn’t figure out how to precompute this, though now I wonder if a second bit board with ‘blocked’ squares on it would have sufficed. Still, the precomputation might have been a bit much – 90 squares, times 8 for the number of ways it could be blocked is 720 combinations, plus 90 for the blocked squares masks.
Actually, it might be worth a look. Anyway, speed is not a huge issue for this right now – it’s only point is to determine valid moves, and I intend to cache the result in a database, so that valid moves can be referred to by FEN…