My current policy is to use variant-specific names as much as possible, and the pieceToCharTable was introduced as a feature to make that possible (when my initial attempt to use global piece IDs ran aground). Because this makes it possible to write PGN that is more meaningful to people used to that variant, and enhances the chances of being able to read existing PGN (if they don't obfuscate the coordinates).Evert wrote:A completely unrelated question/comment (I'd make a new post, but I'm writing this one anyway): is there any systematics in whether variants in XBoard use generic or variant-specific names for pieces? I originally had "ferz" in Makruk, but I changed it to "met", with the rationale that this is the actual name of the piece and it also happens to be the name that XBoard uses. For those exact same reasons, I changed to "Janus" rather than "Archbishop".
However, for Grand chess, the "proper" names for the pieces are "cardinal" and "marshal", but XBoard uses the generic names "Archbishop" and "Chancellor"...
Is it too late to apply some sort of standardisation? I think I would prefer consistently using variant-specific names rather than generic names (but otoh I do prefer "rook" to "chariot" or "boat"), but consistently using either scheme is preferable to things being different for every variant...
Or at the very least, is there some sort of documentation somewhere for the names of pieces across variants?
Or maybe the best solution is to not settle on either (given the already inconsistent set we have now and existing engines that use it) but allow an engine to say "look, this piece that moves like a knight+bishop and that you call an Archbishop, I call a Cardinal" and then XBoard would do some translation when talking to the engines. This could even be done implicitly if the engine sends the starting position using a setup command.
I know it's a relatively minor issue, but I find it annoying.
But when communicating with ICS, I have to follow ICS standards, as it would be a quite complex change to use different pieceToCharTable for ICS compared to PGN and engine. (And you would not be able to read PGN mailed to you by the ICS, etc.) For this reason Shatranj uses B for Elephant and Q for Ferz, because the ICC implemtation ofit has made that the "industry standard" for Shatranj.
The problem is compounded by the fact that ICS do not use pieceToCharTables that can be set per variant, and need the same piece (= code used on the internal board) to be indicated by the same letter in every variant. So to display a piece that moves like Archbishop as 'C' on the board, I would have to introduce a new piece type, add it to the move generator and the move checker, add it to the print routine for all 12 board styles, add code to disambiguate it based on the variant in the move parser, which has separate disambiguation code for moved pieces and promotion pieces. The problem is that the ICS's idea of a 'variant' is normal chess from a non-standard opening position, so there was never need to be aware of what variant you are playing anywhere except in the routine that sets up the opening position, and often the informationisnoteasily available at a place where you need it.
When implementing Grand Chess I did not feel like adding yet another piece that moved as an Archbishop just to be able to be able to indicate it by a C, and expanding the code for disambiguating 'C'. Also because the code at that time was written to assume K was the highest piece (used in array sizes), so that I could not increase the number of pieces without increasing the King code, which would basically invalidate all stored games. So to get it done quickly, I used the already existing Capablanca pieces and their ID.
I must say that I do have some doubt about the desirability to allow each variant to pick yet another name, or at least ID letter, for the same piece. E.g. a KQNKW end-game from Spartan Chess is entirely equivalent to a KQNKH end-game in Seirawan Chess, but the different naming would make it more difficult to look up positions in a database. Especially for 10x8 sub-variants it seems madness to name the B+N and R+N pieces in a zillion different ways. In Chess960 we also do not rename 'King' to 'President' when it happens to start on the d-file, 'Sultan' when it starts on the c-file,'Sjah' when it starts on the b-file...