Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Catalog · How the catalog works

Random project

mater

Mate searching program by Valentin Albillo

View on Codeberg

Anyone may press Interesting, signed in or not. It helps others find this project.

Member rating

No ratings yet.

Sign in to rate this project.

README

Mater

Overview

Mater is a command line tool for searching mates in chess positions.

It has been written in Pascal by Valentin Albillo. You can find the original program here.

The program has been retouched by Roland Chastain. The command line for the retouched version is a little different and two errors have been fixed.

Usage

Mater expects at less two parameters: the position (in EPD format) and the moves number.

A third parameter can be used to change the search mode, so that only mates by consecutive checks are searched.

For example:

pascal
mater -position "3nn3/2p2p1k/1p1pp1p1/p2B3p/r2B2N1/7N/8/7K w KQkq -" -moves 12 -check

The same example with short key names:

pascal
mater -p "3nn3/2p2p1k/1p1pp1p1/p2B3p/r2B2N1/7N/8/7K w KQkq -" -m 12 -c

For other options, please see here.

Examples

Here are eight problems coming from Mater original website. These problems are solved in the program demo.pas.

pascal
fpc -Mobjfpc -Sh demo.pas

Position 1

pascal
mater -p "b7/PP6/8/8/7K/6B1/6N1/4R1bk w - -" -m 3

Position 1

pascal
Found mate in 3: b7a8n

Position 2

pascal
mater -p "8/8/1p5B/4p3/1p2k1P1/1P3n2/P4PB1/K2R4 w - -" -m 3

Position 2

pascal
Found mate in 3: h6c1

Position 3

pascal
mater -p "2N5/8/k2K4/8/p1PB4/P7/8/8 w - -" -m 4

Position 3

pascal
Found mate in 4: d6c7

Position 4

pascal
mater -p "rnbK2R1/p6p/p1kNpN1r/P3B1Q1/3P1p1p/5p2/5p1b/8 w - -" -m 4

Position 4

pascal
Found mate in 4: g5g2

Position 5

pascal
mater -p "8/1n2P2K/3p2p1/2p3pk/6pr/4ppr1/6p1/1b6 w - -" -m 3

Position 5

pascal
Found mate in 3: h7g7

Position 6

pascal
mater -p "4K1R1/PP2P3/2k5/3pP3/3B4/6P1/8/8 w - -" -m 3

Position 6

pascal
Found mate in 3: b7b8r

Position 7

pascal
mater -p "8/2P1P1P1/3PkP2/8/4K3/8/8/8 w - -" -m 3

Position 7

pascal
Found mate in 3: e7e8b

Position 8

pascal
mater -p "3nn3/2p2p1k/1p1pp1p1/p2B3p/r2B2N1/7N/8/7K w - -" -m 12 -c

Position 8

pascal
Found mate in 12: h3g5

Compilation

Mater is compiled with Free Pascal.

When Free Pascal is installed, you can use the following command to build Mater.

pascal
fpc -Mobjfpc -Sh -Fulibrary -Fulibrary/flre/src mater.pas

You can also use the following command.

pascal
make

Home

The new home page of Mater is here. The original page by V. Albillo can be seen on web.archive.org.

History

2021.11.06

  • Fixed pawn move generation (missing pawn color in TestRecordPawn procedure)

2021.11.07

  • Fixed demo data (solution for position 4)

2021.11.20

  • Fixed conversion of square name to integer (bug introduced in the new version of the program, reported by F. Huber)
  • Fixed en passant move generation (correction provided by F. Huber)

Discussion

Interesting links