for Pascal fans: Critter

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
rvida
Posts: 481
Joined: Thu Apr 16, 2009 12:00 pm
Location: Slovakia, EU

for Pascal fans: Critter

Post by rvida »

Pascal source code of something called "OpenCritter_1.1.36" is available from

http://sourceforge.net/projects/critter ... r%20Chess/

This is a dead branch of Critter (dated back to somewhere between 0.90 - 1.00 C++ versions). While it is completely written by me, keep in mind that it is a remnant of an experimental branch that was heavily "ippolitized" ;) Nevertheless, it seems to be the strongest Pascal engine out there.

In the ZIP file there is a Win32 binary, book file, Gaviota TB probing DLLs, and complete sources.

Sources can be compiled with Delphi XE. FreePascal and Linux support is present but atm there are some errors (but they should be trivial to fix - mostly a missing ^ dereference operator).

Richard
bhlangonijr
Posts: 482
Joined: Thu Oct 16, 2008 4:23 am
Location: Milky Way

Re: for Pascal fans: Critter

Post by bhlangonijr »

rvida wrote:Pascal source code of something called "OpenCritter_1.1.36" is available from

http://sourceforge.net/projects/critter ... r%20Chess/

This is a dead branch of Critter (dated back to somewhere between 0.90 - 1.00 C++ versions). While it is completely written by me, keep in mind that it is a remnant of an experimental branch that was heavily "ippolitized" ;) Nevertheless, it seems to be the strongest Pascal engine out there.

In the ZIP file there is a Win32 binary, book file, Gaviota TB probing DLLs, and complete sources.

Sources can be compiled with Delphi XE. FreePascal and Linux support is present but atm there are some errors (but they should be trivial to fix - mostly a missing ^ dereference operator).

Richard
Hello Richard,

Very nice of you sharing the code of Critter.

Thanks,
Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: for Pascal fans: Critter

Post by Ferdy »

Thanks.
I hope it is free to get ideas from these sources :)
User avatar
Ajedrecista
Posts: 1971
Joined: Wed Jul 13, 2011 9:04 pm
Location: Madrid, Spain.

Re: for Pascal fans: Critter

Post by Ajedrecista »

Hello Richard!
rvida wrote:Pascal source code of something called "OpenCritter_1.1.36" is available from

http://sourceforge.net/projects/critter ... r%20Chess/

This is a dead branch of Critter (dated back to somewhere between 0.90 - 1.00 C++ versions). While it is completely written by me, keep in mind that it is a remnant of an experimental branch that was heavily "ippolitized" ;) Nevertheless, it seems to be the strongest Pascal engine out there.

In the ZIP file there is a Win32 binary, book file, Gaviota TB probing DLLs, and complete sources.

Sources can be compiled with Delphi XE. FreePascal and Linux support is present but atm there are some errors (but they should be trivial to fix - mostly a missing ^ dereference operator).

Richard
Thank you very much for this code. I am sure that many people will benefit from it... not me, because I am not a programmer, but I wanted to thank you. Critter is getting more and more strong and it is outstanding!

I suppose you are working in an improved version of Critter... how are your feelings? Are you going to release Critter 1.3 (or the version number that you want) soon (when?)? And also do you expect some Elo gain (or other improvements)? Thanks in advance for your great work.

Regards from Spain.

Ajedrecista.
User avatar
Steve Maughan
Posts: 1221
Joined: Wed Mar 08, 2006 8:28 pm
Location: Florida, USA

Re: for Pascal fans: Critter

Post by Steve Maughan »

Hi Richard,

Great. I'll take a look.

Quick question. You're probably the best person to ask, what is the speed difference between Delphi 32 bit and a PGO Intel C version? So, if the C version does 1 million nodes / second, what will the Delphi version do?

BTW will this compile on the new Delphi XE 2 64 bit platform?

Steve
mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: for Pascal fans: Critter

Post by mcostalba »

rvida wrote:Pascal source code of something called "OpenCritter_1.1.36" is available
Thanks a lot Richard !

I am really eager to take a deep look at your sources, unfortunately these weeks are really terrible for me, I have almost no free time ! So I'd have to postpone to somewhere in future....

Marco
User avatar
JuLieN
Posts: 2949
Joined: Mon May 05, 2008 12:16 pm
Location: Bordeaux (France)
Full name: Julien Marcel

Re: for Pascal fans: Critter

Post by JuLieN »

Thanks a lot, Richard! :) I took a look and it is vastly different from my engine (hence the difference of strength too, I guess :lol: ), so I probably can't really use it (also I'm a bit too lazy and proud to try to understand someone else's code...), but it gives me two thoughts anyway:

1- it's a bit sad to see an abandoned pascal engine, so maybe someone could continue it and try to improve it? (Not me, I'm too busy with mine ^^)
2- yet by itself it's a new strong engine that testers will be pleased to include in their tournaments.
"The only good bug is a dead bug." (Don Dailey)
[Blog: http://tinyurl.com/predateur ] [Facebook: http://tinyurl.com/fbpredateur ] [MacEngines: http://tinyurl.com/macengines ]
User avatar
Steve Maughan
Posts: 1221
Joined: Wed Mar 08, 2006 8:28 pm
Location: Florida, USA

Re: for Pascal fans: Critter

Post by Steve Maughan »

Hi Richard,

As released it doen't compile for Win64. This is due to the ASM BSF and BSR commands.

Anyone know the 64 bit equivalents? Or Pascal if push comes to shove.

Thanks,

Steve
User avatar
rvida
Posts: 481
Joined: Thu Apr 16, 2009 12:00 pm
Location: Slovakia, EU

Re: for Pascal fans: Critter

Post by rvida »

Steve Maughan wrote:Hi Richard,

As released it doen't compile for Win64. This is due to the ASM BSF and BSR commands.

Anyone know the 64 bit equivalents? Or Pascal if push comes to shove.

Thanks,

Steve
Unfortunately I can not test this as I do not have 64bit Delphi yet, but try replacing lines 40..48 in the file magic64.inc:

Code: Select all

function BSF(b: TBitboard): TSquare; assembler;
asm
     bsfq b, %rax
end;

function BSR(b: TBitboard): TSquare; assembler;
asm
     bsrq b, %rax
end;
with

Code: Select all

function BSF(b: TBitboard): TSquare; assembler;
asm
     BSF RAX, b
end;

function BSR(b: TBitboard): TSquare; assembler;
asm
     BSR RAX, b
end;
In platform.inc replace

Code: Select all

{$ifdef FPC}
  {$ifdef CPU64}
    {$define IS_64BIT}
  {$else}
    {$asmmode Intel}
  {$endif}
  {$define HasPrefetch}
  {$define HasBitscan}
{$else}
  {$SetPEFlags 1}
  {$ImportedData Off}
  {$TypeInfo Off}
  {$DenyPackageUnit On}
  {$PointerMath On}
  {$define WinThreads}
  type
    size_t = cardinal;
{$endif}
with

Code: Select all

{$ifdef FPC}
  {$ifdef CPU64}
    {$define IS_64BIT}
  {$else}
    {$asmmode Intel}
  {$endif}
  {$define HasPrefetch}
  {$define HasBitscan}
{$else}
  {$ifdef CPUX64}
    {$define IS_64BIT}
    type
      size_t = uint64;
  {$else}
    {$SetPEFlags 1}
    type
      size_t = cardinal;
  {$endif}
  {$ImportedData Off}
  {$TypeInfo Off}
  {$DenyPackageUnit On}
  {$PointerMath On}
  {$define WinThreads}
{$endif}
Richard
User avatar
Steve Maughan
Posts: 1221
Joined: Wed Mar 08, 2006 8:28 pm
Location: Florida, USA

Re: for Pascal fans: Critter

Post by Steve Maughan »

Hi Richard,

I managed to get it to compile. I needed to make the changes you suggested and add a {$ifdef WIN64} section to "platform.inc".

However, it crashes at line 707 of uBitboard.pas with an access violation as s = -7.

FYI, sq = A1, occ = 0, mask = 35604928818740736, i = 1

This may be helpful,

http://goo.gl/iBxgO

Steve