Support chess problem composition

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

Moderator: Ras

evert823
Posts: 35
Joined: Thu Oct 29, 2020 9:32 am
Full name: Evert Jan Karman

Support chess problem composition

Post by evert823 »

In chess problem composition, a human player aims to construct a position, that contains a forced sequence of moves.
As far as I am aware, there are no chess programs that support this.
That is - if we don't consider that a chess engine is very good at verifying the validity of a proposed problem.
But I haven't yet seen a button for: "create a position with the black King in the middle of the board, where white can give checkmate in 3".

So now I had in mind writing this with this approach:

1.
Program generates random position P1 that is legal, and already mate.

P1 can match certain criteria that the user provides, like endgame-ish, middle game-ish, no Queens, King roughly in the center or in a corner, anything...
From experience I know that this first step is not difficult.

2.
Create a method that I will call GeneratePossiblePreviousNodes (GPPN for brevity):
It will generate a list of all legal positions, that transition to P1 in one legal move.

3.
GPPN can be repeated some number of times so that it generates a tree of nodes that COULD have preceded P1

4.
Run a normal engine on positions, that are n legal moves away from P1. It COULD find a mate in n somewhere in that tree.

After generating P1, steps 2, 3, 4 can be repeated according to the speed of the program.
If it takes too much time finding anything at all, we can also repeat step 1 and start with a new P1.
jefk
Posts: 952
Joined: Sun Jul 25, 2010 10:07 pm
Location: the Netherlands
Full name: Jef Kaan

Re: Support chess problem composition

Post by jefk »

As far as I am aware, there are no chess programs that support this.
there's a program Chestetica but it's not publicly available
https://en.chessbase.com/post/computer- ... r-everyone

don't know if it's using methods as you suggested
https://en.chessbase.com/post/chestheti ... stom-mates
but apparently over the year it made some interesting puzzles
heroku
Posts: 7
Joined: Sat May 23, 2020 5:17 pm
Full name: Emre Guneyler

Re: Support chess problem composition

Post by heroku »

I am working on a language that you can specify certain constraints of a position like attacks and move sequences leading to mates and so forth, that when run can generate positions that satisfies those constraints, It has potential but very early. You can see the initial iteration here:
https://eguneys.github.io/tactics2000-25/
This version has no generator capabilities, but it can test existing positions for example filter a tactics database as presented on the website.

I will eventually document it once I get to a certain stage, but you can dig into source code if you like. Here's the engine's repository:

https://github.com/eguneys/hopefox

There are some tests you can investigate to figure out the syntax.
User avatar
towforce
Posts: 12366
Joined: Thu Mar 09, 2006 12:57 am
Location: Birmingham UK
Full name: Graham Laight

Re: Support chess problem composition

Post by towforce »

I don't know how they did it, but over the centuries human puzzle setters have managed to create positions in which the mate is just a few moves away, is obvious once you see it (or are shown it), but which are fiendishly difficult to find. These puzzlers seem to have a facility for knowing what most players will be drawn to, and which moves they will not look at.

It's not obvious to me how a machine will recreate this special knowledge: are there enough such puzzles to have realistic hope that an NN could be trained to this rare skill?
Human chess is partly about tactics and strategy, but mostly about memory
chesskobra
Posts: 349
Joined: Thu Jul 21, 2022 12:30 am
Full name: Chesskobra

Re: Support chess problem composition

Post by chesskobra »

If you succeed in programming something like that, then I suggest adding one more step: remove redundant pieces. For example, if the forced mate continues to be so if you remove a piece from the position, then you remove the piece. This may depend on the order in which pieces are removed. For example, pieces X and Y may be individually redundant, but after removing X, the piece Y may not be redundant. So find any redundant piece, remove it, then find another, and continue this way. If you do this, then you will have a puzzle in which every piece is important for the puzzle to work.