Some of these are fine, and some are broken.
What should engines do? What do engines do?
Disclaimer/admission: my C code fails because of not much integrity testing at all, but is on the todo list. While my test engine doesn't return in any sensible time in the case of 30 queens. Meanwhile, in Python my EPD checker is robust up to 2,000,000,000 epds thrown at it.
If you want some truly horrific EPD, go screen scrape (e.g. wget -m) Arves or download yacpdb. Problem composition sites are.loaded with bizarre EPD records. No kings, pawns in first and last ranks, ten pawns of one color, etc.
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
Dann Corbit wrote: ↑Wed Feb 19, 2020 6:16 pm
If you want some truly horrific EPD, go screen scrape (e.g. wget -m) Arves or download yacpdb. Problem composition sites are.loaded with bizarre EPD records. No kings, pawns in first and last ranks, ten pawns of one color, etc.
What should chess engines do with bizarre EPDs is the question. I intend various levels of filter:
0. Will always disallow junky EPDs that decline reasonable parsing, lack of fields, wrong number squares and so on
1. Will always disallow chess illegal positions. Including pawn ranks, king count, opponent in check, impossible castling flags, dumb movenums, impossible ep square.
2. Will catch side to move being asked to search for a move when there is no move possible, game already over
Optional:
3. Will additionally disallow > 32 pieces but will allow things like 15 queens for one side
4. Will additionally disallow chess illegal piece counts (queens > N depending on pawn count etc)
It depends on what positions the engine can (or is willing) to handle. If it has no problem playing with 15 Queens, it would be a waste to prevent the user from exercising that capability. If its piece-list structure (say) would only allow for 3 Queens max, you will be forced to refuse the position. For UCI engines there is no formal way to report errors, though. You could use an 'info string' response in the hope that the GUI would show that to the user, but if that goes unnoticed, it is unavoidable that the GUI from that point on will assume a different position than the engine. UCI engines can also not resign. The only sure way to catch the user's attention is to make the engine quit. It isn't a bug, it is a (UCI) feature!
I must admit that even CECP has no formal way to complain against invalid positions loaded into the engine (so that the GUI could switch back to the position before it had before, as it would do on an illegal-move complaint). The specs recommend to just reject any subsequent move as illegal after loading an illegal position. And CECP offers more forceful ways to present a message to the user.
The many components of a chess system all intertwine.
There is the chess GUI which may or may not handle a board with 31 white queens, one white king, 31 black queens and one black king.
There is the chess engine, which might pop his tiny little arrays and spew a 7 gig core dump.
And there is the wicked author of positions who composes things that simply are not possible in the game of chess.
Now, it is possible that GUIs and engines and interfaces can handle any sort of nonsense.
And it is good also if they recognize that they have bitten off more than they can chew and must punt the football.
In such a case, a friendly program will simply call the user dirty names and refuse to accept the position.
There are balky engines that won't even promote to bishop for me. But that is a design choice and I have to live with it or use another engine.
So it is possible for engines to reject even legal moves just because the designer cares only about Elo and not the art of the moves in a special problem.
As in just about everything in life, sometimes there are no simple answers. But we can try to come up with better answers if we attempt it.
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
I think it is simple. Things are made for a purpose, and different purposes have often incompatible requirements. An tool for driving nails into the walls is quite unsuitable to sleep on. This is why we have developed a very wide range of tools. It is the same in chess. Having highest possible Elo and solving some quirky compositions (such as those requiring Bishop promotion or series of zugzwangs) are at odds with each other. You have to pick the tool (= engine) that was designed for the purpose you want to use it for.
You have no right to complain if you use a tool for the wrong purpose and it lets you down. Products should only be used within their specifications. If the specifications say you should feed it valid EPDs, because its purpose is to work under a GUI that uses a communication protocol that guarantees that, yfeeding it invalid EPDs is at your own risk. It might work, or might result in the proverbial nasal demons. You cannot dictate the developers to alter the purpose of their program to suit you.
The thing is, I collect billions of EPD records from the internet (no, really, billions). So there are going to be errors.
What if the demon generators were handed to me, like this bunch (no, really, both kings in check, from Yacpdb):
1B6/prpb2p1/2KPp3/qp1p4/Q1k5/nRP3p1/BRPP2Pp/BN6 w - -
1N4B1/2p2p2/2Q3k1/p2p1RPp/P4P1b/7P/2PPPrrK/8 w - -
1N6/p7/5R2/nkR1r3/rp1QB3/qNpp4/1p1n1p2/1K2b3 w - -
1Q2Rb2/1NB2kp1/4P2R/2K2P2/2p1P3/P7/n1bnPPP1/r2q4 w - -
1Q6/3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qBb2/nQr2pp1/2pK1p2/1k6/bPpp2p1/1P1P2P1/3P4/8 w - -
Rb3b2/p1Bp1Rp1/P1pK1p2/nb6/p1k4P/2PP2P1/B1P1P3/rN6 w - -
bn2rb2/1rP4R/1KBkQP2/3P1n2/1N6/3NR3/8/6q1 w - -
k5Rq/4RNP1/5PPK/6N1/5B1r/7B/8/8 w - -
n5K1/7R/1pk2PN1/4N2R/PP2B3/1bP1P3/7B/8 w - -
q1KNNn1n/8/8/8/8/2brrb2/1RR5/3QQkB1 w - -
r2R1kb1/2R5/4P1B1/3pP3/1p1N4/1p2K1pN/1PP3Q1/n5br w - -
r6k/1K2q1Q1/8/8/8/8/8/8 w - -
r7/2N5/1bk5/p2P4/p1np4/B7/2K4r/8 w - -
rnb1k2r/pppp1ppp/8/4Q3/4P3/4q3/P1P2PPP/4KB1R w - -
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
Well, if a tool to filter those for a certain degree of legality doesn't exist, you would have to make it yourself. You cannot expect engines to do that; it is not their task. Which makes sense: engines are not stand-alone programs, but plugins for a GUI. Making the engine do the checking would require the check in many more places than having the GUI do it. There exist far more engines than GUIs. So requiring the engine does it would just be very inefficient division of labor. The program that feeds them to the engine must do it. If you use your own program for that, better make sure it does it.
UCI is more dogmatic in this than CECP. At least CECP allows engines to object to their input, through a formal Error command, or through 'Illegal Move'. So you can have the best of both worlds there: if you design an engine for some weird variant that no other engine plays, the ratio GUIs:engines reverses, and it does make sense to delegate things like legality checking to the engine, instead of requiring all GUIs to do it.