Thursday, September 15, 2011

ChessKISS 64 bits finally works as expected!

I've finally found the error that provokes a different behaviour between the 32 and 64 bits version of ChessKISS, see this highlighted code in EvalRook():

//Check to see if the king has been forced to move and has trapped a rook at a1/b1/g1/h1,
  //if so, then penalize the trapped rook to help extricate it
  if FStage <= sMiddle then
  begin
    x := AllowedCols[col];
    if (x > 0) and (aPiece.GetRank = 1) then
    begin
      //blocked up?
      if (FBoard.GetPiece(aPiece.Forward) <> nil) and
      //Blocked left or right
         (FBoard.GetPieceType(aPiece.Index + Deltas[x]) = Kings[me]) then
        Dec(pos, TRAPPED_ROOK_PENALTY);
    end
end;

That is new and also was having an unknown behaviour in 32 bits in the trapped rook scenario:

  • Stage before ending
  • Columns 1 or 2 or 7 or 8
  • Next square occupied
  • Left or right squares, occupied by own king
But this should only be checked in rank 1!!!, in the other ranks it does not make sense, but even worst on the last rank you can only get garbage since the piece is out of the board...

Well, I will upload a fix for this and also the brand new 64 bits version

No comments:

Post a Comment