# Generate Simple Mate In 1 From Tablebases (for kids)

I was trying to find a kid's app for chess that has some incredibly simple problems. However, all the apps I found had rather tricky problems. So I thought I would download 3 piece table bases and use SCID (or grep, if necessary) to create a 3-piece Mate-In-One tablebase PGN. Then just use that in iChess or any other problem app that allows PGN imports.

Much to my chagrin, the tablebases aren't in PGN format as I expected (and I cant even read them in a text editor. Guess I really misunderstand how these tablebases work).

Any solutions out there?

• Tablebases have their own format which aren't human readable. But, would you really need a tablebase for this? Isn't that a bit overkill? Dec 27, 2016 at 21:29
• Just the most direct solution I (thought that) I came up with. How would you go about it (my idea also expanded to 4,5 and 6 piece endgames as appropriate).
– Kale
Dec 27, 2016 at 21:40
• Well, think of a position that is checkmate say with K+R v K, and then move the rook somewhere else. You can probably think of new positions faster than they solve them. Dec 28, 2016 at 14:17
• Can't you take any database of real games and search for games that end in mate and then extract the position one move before the last? Dec 28, 2016 at 18:03
• @user1583209 That would be a better approach. FICS and Lichess has many such games. But we are here to answer the question. Dec 29, 2016 at 12:08

It's possible to generate mates in 1,2,3 etc with tablebase, but that's probably not what you want. You should understand:

• You will need good programming knowledge
• You will need a week generating 6-men tablebase mates
• You will generate too many mates than you can possibly study

If you are confident in programming, you can do this:

• Modify the Gaviota tablebase generator (ask the author for source code). Find where it calculates distance-to-mate, if it's one (or two or three), print the position out.
• Modify the Syzygy tablebase generator. Syzygy reports distance-to-zero, so you may need to use online probing (e.g. Nalimov) or an engine.
• Use the public API in https://syzygy-tables.info. Start from a randomised position. Use the API result to move your position to mate-in-one.

If you don't have any idea what I'm talking about, generating mate positions with tableabse is not for you. You should:

• Buy a book with mate-in-one positions. There is an Android app that can read a chess diagram and convert it to PGN.

EDIT: You shouldn't generate total random FENs. You should try to generate FENs that either side has an extra rook, queen etc.

• The API looks like the trick. Any pointers on generating random FENs?
– Kale
Dec 28, 2016 at 12:53
• – Kale
Dec 28, 2016 at 13:01
• @Kale Yeah, that should work although not very efficient. You should not generate total random FENs. Your FEN will be most likely result in a mate if either side has extra material. Dec 29, 2016 at 12:08
• @Kale If you think my answer is sufficient for you to get started, please put a tick and accept it! Dec 29, 2016 at 12:10
• Yes, more specifically, I meant random within the limit of X number of pieces.
– Kale
Dec 29, 2016 at 15:22