Sunday, March 6, 2022

ChessKISS 1.8d bug fix version

Computer chess is a fascinating area to introduced bugs that are so difficult to catch.

In my mind it good a good idea to remove the king in order to improve the performance, but it turns out that in king confrontations it created a king mate...


function TChessboard.InCheck(aSide: TSide; out aPiece: TPiece): TCheck;
var
  king: TPiece;

begin
  king := GetKing(aSide);
  if king = NO_PIECE then
    Exit(checkUnknown);

  aPiece := GetPieceAbleToMoveToSquare(TUtils.Switch(aSide), TPieceHelper.GetIndex(king), actCapture, [ptPawn, ptKnight, ptBishop, ptRook, ptQueen]);
  if aPiece <> NO_PIECE then
    Exit(checkYes)
  else
    Exit(checkNo);
end;

I think I'm done for the time being, I want to focus on other projects.


Find the new binaries at OneDrive

No comments:

Post a Comment