Mater adapted for Free Pascal

Discussion of anything and everything relating to chess playing software and machines.

Moderators: hgm, Rebel, chrisw

User avatar
Roland Chastain
Posts: 657
Joined: Sat Jun 08, 2013 10:07 am
Location: France
Full name: Roland Chastain

Mater adapted for Free Pascal

Post by Roland Chastain »

Hello Pascal lovers (and other)!

I think I never created a discussion to present my adaptation of the excellent Mater program by Valentin Albillo. It's a mate solver, originally written for Turbo Pascal. The new version can be compiled with Free Pascal for Linux and for Windows. You can find it here, with the original program:

https://gitlab.com/rchastain/mater

Yesterday I restarted to work on this project, after I discovered (thanks to this post) two positions for which Mater gives wrong results (unexisting mates). If someone is in the mood to break his head on this, I created an issue with all informations on the GitLab repository.

Regards.

Roland
Qui trop embrasse mal étreint.
Andrew
Posts: 231
Joined: Thu Mar 09, 2006 12:51 am
Location: Australia

Re: Mater adapted for Free Pascal

Post by Andrew »

Thanks Roland! I hope you've been able to resolve the issue with those positions.

Andrew
User avatar
Roland Chastain
Posts: 657
Joined: Sat Jun 08, 2013 10:07 am
Location: France
Full name: Roland Chastain

Re: Mater adapted for Free Pascal

Post by Roland Chastain »

Andrew wrote: Fri Nov 05, 2021 9:32 am Thanks Roland! I hope you've been able to resolve the issue with those positions.
Thank you Andrew for your support.

I found the error. 8-)

The "position 130" is correctly analyzed now.

Code: Select all

./mater -position "3r1n2/2bp2p1/1p1kp1Pp/4N2p/Pp2B2Q/7P/1P3P1B/K7 w - - 0 1" -moves 4
Mater 1.1.20211106
Position: 3r1n2/2bp2p1/1p1kp1Pp/4N2p/Pp2B2Q/7P/1P3P1B/K7 w - - 0 1
Moves number: 4
Search mode: all moves
Found mate in 4: e4a8
Time elapsed: 00:00:01:755
I created a tag. I will add a binary for Linux.
Qui trop embrasse mal étreint.
User avatar
Roland Chastain
Posts: 657
Joined: Sat Jun 08, 2013 10:07 am
Location: France
Full name: Roland Chastain

Re: Mater adapted for Free Pascal

Post by Roland Chastain »

Roland Chastain wrote: Sat Nov 06, 2021 7:47 pm I created a tag. I will add a binary for Linux.
Done. Also added a Makefile to the repository, so one can build Mater (and the demo program) easily for Linux or for Windows.

Since the bug in pawn move generation was fixed, the demo program finds a different solution for the position 4. It finds now g5g2, instead of f6d5. Not yet had time to check if it's a valid solution...
Qui trop embrasse mal étreint.
Colin-G
Posts: 191
Joined: Mon Oct 31, 2016 6:30 pm
Location: England

Re: Mater adapted for Free Pascal

Post by Colin-G »

Roland Chastain wrote: Fri Nov 05, 2021 9:11 am Hello Pascal lovers (and other)!

I think I never created a discussion to present my adaptation of the excellent Mater program by Valentin Albillo. It's a mate solver, originally written for Turbo Pascal. The new version can be compiled with Free Pascal for Linux and for Windows. You can find it here, with the original program:

https://gitlab.com/rchastain/mater

Yesterday I restarted to work on this project, after I discovered (thanks to this post) two positions for which Mater gives wrong results (unexisting mates). If someone is in the mood to break his head on this, I created an issue with all informations on the GitLab repository.

Regards.

Roland
As a Pascal user, I wonder if you have ever managed to compile a version of the Booot chess engine to work in linux?
I used Borland Delphi many years ago and have since tried fpc and lazarus but have had no success compiling Booot. The Pascal source is supplied by the author but maybe its window's specific.
I have to use Booot with wine in linux but prefer to use native linux versions where possible.
User avatar
Roland Chastain
Posts: 657
Joined: Sat Jun 08, 2013 10:07 am
Location: France
Full name: Roland Chastain

Re: Mater adapted for Free Pascal

Post by Roland Chastain »

Colin-G wrote: Sun Nov 07, 2021 1:12 pm As a Pascal user, I wonder if you have ever managed to compile a version of the Booot chess engine to work in linux?
I used Borland Delphi many years ago and have since tried fpc and lazarus but have had no success compiling Booot. The Pascal source is supplied by the author but maybe its window's specific.
Unfortunately no. I tried, but gave up because there are many things to change, and there are things that I don't know how to replace.
Qui trop embrasse mal étreint.
User avatar
Roland Chastain
Posts: 657
Joined: Sat Jun 08, 2013 10:07 am
Location: France
Full name: Roland Chastain

Re: Mater adapted for Free Pascal

Post by Roland Chastain »

Roland Chastain wrote: Sun Nov 07, 2021 12:06 pm Since the bug in pawn move generation was fixed, the demo program finds a different solution for the position 4. It finds now g5g2, instead of f6d5. Not yet had time to check if it's a valid solution...
Stockfish MateFinder 9.7 finds also g5g2. So I have a doubt now on f6d5. :)

Would someone know a mate solver available for Linux, which detects multiple solutions?
Qui trop embrasse mal étreint.
User avatar
F.Huber
Posts: 854
Joined: Thu Mar 09, 2006 4:50 pm
Location: Austria

Re: Mater adapted for Free Pascal

Post by F.Huber »

Hi,
Roland Chastain wrote: Sun Nov 07, 2021 9:44 pm Stockfish MateFinder 9.7 finds also g5g2. So I have a doubt now on f6d5. :)

Would someone know a mate solver available for Linux, which detects multiple solutions?
g5g2 is the only solution for this mate in 4:

Code: Select all

ChestUCI Ver.5.2:
FEN: rnbK2R1/p6p/p1kNpN1r/P3B1Q1/3P1p1p/5p2/5p1b/8 w - -   (8+14)
Position-Analysis:  C0/R0/K1/P6/X13   W:7/36
Search for Special-Mate [C0/R0/K0/P0/X0] in 10 ...  (Hash=256MB)
   4	00:00	           0	0	+M4	1.Qg2
Search completed ...  (Time=0.03s)
Mate in 4 found !  (1 Solution in 00:00)
  4/4	00:00	      28.586	893.312	+M4	1.Qg2 fxg2 2.Rg3 hxg3 3.Ng8 f1Q 4.Ne7+
Best move: Qg2, Value: +Mate in 4, Depth: 4/4, Time: 00:00,104, 28.586 Nodes, 893.312 N/sec

Code: Select all

MaterUCI-Pro Ver.3.2:
Search for Mate in 1 ...
Search for Mate in 2 ...
Search for Mate in 3 ...
Search for Mate in 4 ...
   4	00:00	   4.860.056	4.860.056	+M4	1.Qg2 Bd7 2.Rf8 Bc8 3.Rf7 Nd7 4.Qxf3+
Best move: Qg2, Value: +Mate in 4, Depth: 4, Time: 00:00,838, 4.860.056 Nodes, 4.860.056 N/sec
User avatar
Roland Chastain
Posts: 657
Joined: Sat Jun 08, 2013 10:07 am
Location: France
Full name: Roland Chastain

Re: Mater adapted for Free Pascal

Post by Roland Chastain »

F.Huber wrote: Sun Nov 07, 2021 11:06 pm Hi,
g5g2 is the only solution for this mate in 4:
Hi! Thank you very much. Files updated.
Qui trop embrasse mal étreint.
Joerg Oster
Posts: 945
Joined: Fri Mar 10, 2006 4:29 pm
Location: Germany
Full name: Jörg Oster

Re: Mater adapted for Free Pascal

Post by Joerg Oster »

Roland Chastain wrote: Sun Nov 07, 2021 9:44 pm
Roland Chastain wrote: Sun Nov 07, 2021 12:06 pm Since the bug in pawn move generation was fixed, the demo program finds a different solution for the position 4. It finds now g5g2, instead of f6d5. Not yet had time to check if it's a valid solution...
Stockfish MateFinder 9.7 finds also g5g2. So I have a doubt now on f6d5. :)

Would someone know a mate solver available for Linux, which detects multiple solutions?
You might give Matefish 1.0 a try.
It is based on Stockfish 11 and at a very early stage.

It doesn't search for multiple/all solutions for now.
But as a workaround, it supports the searchmoves option just like Stockfish does.

Code: Select all

position fen rnbK2R1/p6p/p1kNpN1r/P3B1Q1/3P1p1p/5p2/5p1b/8 w - -
go mate 4
info string No mate in 1 found
info string No mate in 2 found
info string No mate in 3 found
info string Success! Mate in 4 found!
info depth 5 seldepth 7 multipv 1 score mate 4 nodes 126599 nps 1130348 tbhits 0 time 112 pv g5g2 f3g2 g8g3 h4g3 f6g8 f2f1q g8e7
bestmove g5g2 ponder f3g2

go mate 4 searchmoves f6d5
info string No mate in 1 found
info string No mate in 2 found
info string No mate in 3 found
info string No mate in 4 found
info depth 7 seldepth 7 multipv 1 score cp 0 nodes 1284 nps 428000 tbhits 0 time 3 pv f6d5
bestmove f6d5
Since I didn't have time to test in any GUI I recommend to use it in a command line.

You can find its source here https://github.com/joergoster/Stockfish/tree/matefish.
Compiling with gcc should be trivial, for example make build ARCH=x86-64-modern -j.
Jörg Oster