Sunday, February 5, 2012

CPU hunter...

 I've uploaded a new version the binary, with a tiny change that reduces notably the CPU usage just introducing a Sleep(1) in the main function:

var
  engine: TChessEngine;
  think: TMoveStatus;

begin
  //ReportMemoryLeaksOnShutdown := True;

  engine := TChessEngine.Create;
  try
    WriteLn('ChessKISS');
    WriteLn('version ' + GAME_VERSION + ' ' + RELEASE_DATE);
    {$IFDEF WIN32}
    WriteLn('32 bits');
    {$ELSE}
    WriteLn('64 bits');
    {$ENDIF}
    WriteLn;
    WriteLn('Type "help" for a list of available commands');

    repeat
      Sleep(1);  //here goes the change

      think := engine.Think;
      if think in [msCheckmate, msStalemate, msWithdraw, ms50MovesRule, msThreefoldRep] then
      begin
        engine.SaveAperture(think);
        engine.SendDataToWinboard(think, '');
        engine.Clear;
      end;

      if engine.GameStatus = gsQuit then
        Break;

    until False;
  finally
    engine.Free;
  end;
end.

Thanks Graham for pointing it out!

4 comments:

  1. Hi hate to tell you this, but something seems very wrong with ChessKiss 1.5a. Eleven straight losses in my "Knife Cuts" tourney. I can send you the games to look at if you let me know how.

    ReplyDelete
  2. Something is definitely badly wrong with ChessKiss 1.5a. It has lost all eighteen games played so far here. Games and debug files are available, but I don't know how to get them to you.

    ReplyDelete
  3. Wow, in my internal tests it was winning against previous versions, very strange...

    You can do it at abel.belzunces@gmail.com

    Thanks!

    ReplyDelete
  4. I've found the issue, only affecting the non SSE4 versions, bloddy copy & paste...

    Thanks for your feedback!

    ReplyDelete