Mater adapted for Free Pascal

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

Moderator: Ras

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

Re: Mater adapted for Free Pascal

Post by Roland Chastain »

Joerg Oster wrote: Mon Nov 08, 2021 10:59 am You might give Matefish 1.0 a try.
Very interesting. Compilation and test successful. Thank you.
Qui trop embrasse mal étreint.
Joerg Oster
Posts: 957
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: Mon Nov 08, 2021 11:28 am
Joerg Oster wrote: Mon Nov 08, 2021 10:59 am You might give Matefish 1.0 a try.
Very interesting. Compilation and test successful. Thank you.
You're welcome.
For positions like #8 from your Mater site, you can set UCI option "Checks Only" to true,
which will speed up mate-finding tremendously.

Code: Select all

uciok
setoption name Checks Only value true
ucinewgame
position fen 3nn3/2p2p1k/1p1pp1p1/p2B3p/r2B2N1/7N/8/7K w - -
go mate 12
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 string No mate in 5 found
info string No mate in 6 found
info string No mate in 7 found
info string No mate in 8 found
info string No mate in 9 found
info string No mate in 10 found
info string No mate in 11 found
info string Success! Mate in 12 found!
info depth 23 seldepth 23 multipv 1 score mate 12 nodes 1354 nps 677000 tbhits 0 time 2 pv h3g5 h7g8 g4h6 g8f8 g5h7 f8e7 h6g8 e7d7 h7f8 d7c8 g8e7 c8b8 f8d7 b8a7 e7c8 a7a6 d7b8 a6b5 c8a7 b5b4 b8a6 b4a3 a7b5
bestmove h3g5 ponder h7g8
Another example:

Code: Select all

position fen 7r/k1N2p2/4b3/4p2r/2R5/4PK2/8/7R w - -
go mate 13
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 string No mate in 5 found
info string No mate in 6 found
info string No mate in 7 found
info string No mate in 8 found
info string No mate in 9 found
info string No mate in 10 found
info string No mate in 11 found
info string No mate in 12 found
info string Success! Mate in 13 found!
info depth 25 seldepth 25 multipv 1 score mate 13 nodes 707243 nps 1378641 tbhits 0 time 513 pv h1a1 a7b7 a1b1 b7c8 c7e6 c8d7 c4c7 d7e6 b1b6 e6f5 c7f7 f5g5 f7g7 g5h4 g7g4 h4h3 g4g3 h3h2 b6b2 h2h1 b2b1 h1h2 g3g2 h2h3 b1h1
bestmove h1a1 ponder a7b7
Jörg Oster
User avatar
Roland Chastain
Posts: 669
Joined: Sat Jun 08, 2013 10:07 am
Location: France
Full name: Roland Chastain

Mater for Free Pascal 1.1.20211107

Post by Roland Chastain »

Joerg Oster wrote: Mon Nov 08, 2021 2:43 pm For positions like #8 from your Mater site, you can set UCI option "Checks Only" to true,
which will speed up mate-finding tremendously.
Good to know. I will use it. (By the way, I would have written the option name in one word, "ChecksOnly" or "Checks_Only". My two cents. :) )

I made a new release of Mater with fixed demo data. There are binaries for Linux and for Windows (both 64-bit).

Mater for Free Pascal 1.1.20211107

Regards.

Roland
Qui trop embrasse mal étreint.
User avatar
Roland Chastain
Posts: 669
Joined: Sat Jun 08, 2013 10:07 am
Location: France
Full name: Roland Chastain

El Arte del Mate en Dos: 41 positions not solved

Post by Roland Chastain »

Tested Mater with the 155078 positions from this database of mate-in-two-moves problems. (El Arte del Mate en Dos, Eduardo Sadier.)

There are 41 positions that Mater does not solve. Here are the positions:

Code: Select all

[2726]=8/5N1R/5P2/1Q1nNkP1/8/4B2R/1K3P2/8 b - - 0 1
[10233]=8/2N5/3p4/P2P2P1/p1Bk2PN/Pp1P2P1/1R1RPp1p/5Kbr b - - 0 1
[10252]=2Q5/8/1B5K/8/R7/6k1/8/8 b - - 0 1
[11579]=8/Qn6/Pnp2N2/2k2p2/P1p2Bp1/2P3K1/8/8 b - - 0 1
[12273]=8/2B2b1N/R2P3K/R1rrkP1n/q3P2p/2N1P2B/1Q6/8 b - - 0 1
[12865]=8/3kNK1p/p1p3pP/BpPp2P1/1Qp4R/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3Q/8/8/R3K3 b Q - 0 1
[147227]=1B1n2K1/4pP2/2p1k3/r2N2P1/3bp2P/pQ4p1/B7/8 b - - 0 1
[147230]=8/8/6p1/5p2/5QPk/8/1p3N2/bK6 b - - 0 1
[148380]=8/8/2B5/b7/2k5/4Q3/3p4/3N3K b - - 0 1
[151088]=8/2r3Np/7k/6RB/2Q5/4P3/b7/7K b - - 0 1
[153677]=8/8/6N1/2p3p1/2Rp1pk1/2PK2Np/4P2P/3B4 b - - 0 1
[154593]=3K4/8/n2k3P/3P3R/n2B4/4P1p1/3Q4/6b1 b - - 0 1
Time elapsed 00:03:45:730
Found 155029/155078
Qui trop embrasse mal étreint.
User avatar
F.Huber
Posts: 855
Joined: Thu Mar 09, 2006 4:50 pm
Location: Austria

Re: El Arte del Mate en Dos: 41 positions not solved

Post by F.Huber »

Roland Chastain wrote: Thu Nov 11, 2021 9:39 pm Tested Mater with the 155078 positions from this database of mate-in-two-moves problems. (El Arte del Mate en Dos, Eduardo Sadier.)

There are 41 positions that Mater does not solve. Here are the positions:
The reason is, that for all of these positions the side to move is wrong, it should be " w " instead of " b ".
And a few of them are mate in 3, not in 2.
User avatar
Roland Chastain
Posts: 669
Joined: Sat Jun 08, 2013 10:07 am
Location: France
Full name: Roland Chastain

Re: El Arte del Mate en Dos: 41 positions not solved

Post by Roland Chastain »

F.Huber wrote: Thu Nov 11, 2021 11:53 pm The reason is, that for all of these positions the side to move is wrong, it should be " w " instead of " b ".
And a few of them are mate in 3, not in 2.
Indeed. Thank you for your help! Problem solved.
Qui trop embrasse mal étreint.
User avatar
Roland Chastain
Posts: 669
Joined: Sat Jun 08, 2013 10:07 am
Location: France
Full name: Roland Chastain

Re: Mater adapted for Free Pascal

Post by Roland Chastain »

I made a simple GUI. It's a Lazarus project. Works on Linux and Windows.

Image

Don't forget to compile Mater first (in release mode, otherwise it is very slow):

Code: Select all

make release
Qui trop embrasse mal étreint.
User avatar
Roland Chastain
Posts: 669
Joined: Sat Jun 08, 2013 10:07 am
Location: France
Full name: Roland Chastain

Mater GUI 0.2.1

Post by Roland Chastain »

A new version of Mater GUI is available. See screenshot in the previous post.

Uses Chest as second mate solver. Linux and Windows binaries.

Mater GUI 0.2.1

I compiled Chest 3.19 for Linux. I took the Windows binary in ChestUCI package.

Please try it and tell me what you think.

Regards.

Roland
Qui trop embrasse mal étreint.
User avatar
F.Huber
Posts: 855
Joined: Thu Mar 09, 2006 4:50 pm
Location: Austria

Re: Mater GUI 0.2.1

Post by F.Huber »

Roland Chastain wrote: Tue Nov 16, 2021 1:38 pm A new version of Mater GUI is available. See screenshot in the previous post.

Uses Chest as second mate solver. Linux and Windows binaries.

Mater GUI 0.2.1

I compiled Chest 3.19 for Linux. I took the Windows binary in ChestUCI package.

Please try it and tell me what you think.
Hi Roland,

nice to see that you've added Chest as additional solver. :)

There are a few problems with (Win)Chest in MaterGUI, which I've fixed:
1) Chest accepts only the first 4 fields in a FEN, so all FENs in your files with " 0 1" at the end don't work,
and Chest returns "No mate found"!
I've fixed this by removing these fields in FPosition before sending it to the solvers.

2) WinChest also has a 'ChecksOnly' mode, but the syntax is different to Mater:
normal mates in N are solved with '-Z N', and mates with ChecksOnly with '-C N'.
I've changed CChestCommand and added a new CChestSearchMode (because it's different for Windows and Linux),
so now this MaterGUI option is now also working for WinChest.
(the original Chest does not have such an option "-C N", so your Linux compile 'dchest' is still searching for a
normal mate even when this MaterGUI option 'Check only' is used).

3) Since Mater is extremly slow for mates >= 6 (Chest is x-100-times faster!), I've changed the order
of the 2 solvers: now first I let Chest search for the mate and display the solution immediately,
and only after that Mater starts searching.
(thus the procedure 'OnResult' is not necessary anymore)

4) And while the solvers are searching, I've deactivated the button [Search], because if anyone clicks on this
button again during the search (e.g. because Mater needs very long), then MaterGUI would start both solvers
again and again, i.e. there would be several Mater processes in memory.

This slowness of Mater for longer mates leads to the next problem:
I've tried several ways to abort Mater's searching process, but unfortunately nothing worked.
On the commandline Mater can be aborted with Ctrl-C, but I don't know how to send such a Ctrl-C to the
Mater process in the MaterGUI or if this is possible at all (all my trials to 'terminate' or 'close' this process failed.
Not being able to abort the Mater search is also a big problem, because even if you close MaterGUI (with [Quit]),
then the mater process is still in memory and searching - can only be terminated with the Windows tascmanager.
Maybe you know a method in FreePascal to solve this problem? If yes, then the button [Search] could be changed
to [Stop] or [Abort] during the search process!?

All these changes are only in the file 'mainform.pas' - if you are interested to implement this in your version,
then I've uploaded this file here for you:
https://www50.zippyshare.com/v/xZzeyd6W/file.html
It's based on your current (todays) version, so you could even replace it without having to change anything yourself.

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

Re: Mater GUI 0.2.1

Post by Roland Chastain »

F.Huber wrote: Thu Nov 18, 2021 8:27 pm nice to see that you've added Chest as additional solver. :)
Hi Franz.

Thank you very much for your interest in that project, and for all these useful informations.

Of course I am interested to implement your changes! But I couldn't download your file. When I clicked on the Download button I saw only ladies without clothes. :)

Could you find another way to send me the file? Maybe by opening an issue on GitLab (if you have an account) and attaching the file? Or else by mail if you don't mind? I send you my mail in a private message.

Regards.

Roland
Qui trop embrasse mal étreint.