FEEN?

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

Moderator: Ras

User avatar
hgm
Posts: 28353
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: FEEN?

Post by hgm »

Don wrote:In the absence of lowercase one could have 2 position fields - one for each side. It would make the fen string itself larger but presumably that is going to happen no matter what you do.
Interesting idea. As in practical middle-game positions the various sides would not penetrate much into each other's lines, so the opponent's camp in such a representation would pretty much show up as an empty board half. And FENs are quite efficient in encoding empty space. So the FEN would not grow that much longer. In the late end-game, when all pieces roam the board, there would not be many pieces anyway, and the FEN would be short.

Not having to worry about distinguishing sides could also be very beneficial for encoding in ASCII. It is not just that you could double the available IDs by using both upper and lower case for the same side, (which would still not be enough for some of the bigger variants), but you could use a compact encoding with two-letter IDs (or actually arbitrary length IDs) without separators, where the first letter would be a capital. For the Chu Shogi start position this would give

LFlCSGKDeGSCFlL/Rv1B1BtPhKyBt1B1Rv/SmVmRDhDkFkLnDkDhRVmSm/PPPPPPPPPPPP/3Gb4Gb3/12/12/12/12/12/12/12//12/12/12/12/12/12/12/3Gb4Gb3/PPPPPPPPPPPP/SmVmRDhDkLnFkDkDhRVmSm/Rv1B1BtKyPhBt1B1Rv/LFlCSGDeKGSCFlL w 0 1

which is sort of readable.

I was thinking myself about using two-character piece IDs where the second is a letter that would encode the side in the usual way, but the first one would be non-alphanumeric, so that it can easily be recognized as a prefix altering the meaning of the following letter. E.g. using . , : ; as prefixes you would already have 4 x 26 possible IDs. This is far less than the 26x26 that can be achieved with Don's proposal, but enough for anything but the very largest (some would say 'insane') variants. The prefixes would have little optical density, and naturally act as separators to enhance readability. The Chu Shogi start position in this notation could look like:

.l,l.c.s.g.k.e.g.s.c,l.l/,r1.b1.t,p:k.t1.b1,r/,s.v.r.h.d;f;l.d.h.r.v,s/.p.p.p.p.p.p.p.p.p.p.p.p/3,g4,g3/12/12/3,G4,G3/.P.P.P.P.P.P.P.P.P.P.P.P/,S.V.R.H.D;L;F.D.H.R.V,S/,R1.B1.T:K,P.T1.B1,R/.L,L.C.S.G.E.K.G.S.C,L.L w

where .L would mean Lance but ,L would mean Ferocious Leopard, etc. I guess it might be better to also allow pieces without prefix, and with a space prefix

l.lcsgkegsc.ll/.r1b1t.p:kt1b1.r/.svrhd;f;ldhrv.s/pppppppppppp/3.g4.g3/12/12/3.G4.G3/PPPPPPPPPPPP/.SVRHD;L;FDHRV.S/.R1B1T:K.PT1B1.R/L.LCSGEKGSC.LL w

I think Don's proposal is better. It is also easily extendible to games with more than two players. The downside is that there is no backward compatibility with the FEN standard for Chess.
User avatar
Don
Posts: 5106
Joined: Tue Apr 29, 2008 4:27 pm

Re: FEEN?

Post by Don »

hgm wrote:Interesting idea. As in practical middle-game positions the various sides woul not penetrate much into each other's lines, the oppoent half so the board in such a representation would pretty much show up as an empty board half. And FENs are extremely efficient in encoding empty space. So the FEN would not grow that much longer.

Not having to worry about distinguishing sides could also be very beneficial for encoding in ASCII. It is not just that you could double the available IDs by using both upper and lower case for the same side, (which would still not be enough for some of the bigger variants), but you could use a compact encoding with two-letter IDs (or actually arbitrary length IDs) without separators, where the first letter would be a capital. For the Chu Shogi start position this would give

LFlCSGKDeGSCFlL/Rv1B1BtPhKyBt1B1Rv/SmVmRDhDkFkLnDkDhRVmSm/PPPPPPPPPPPP/3Gb4Gb3/12/12/12/12/12/12/12//12/12/12/12/12/12/12/3Gb4Gb3/PPPPPPPPPPPP/SmVmRDhDkLnFkDkDhRVmSm/Rv1B1BtKyPhBt1B1Rv/LFlCSGDeKGSCFlL w 0 1

which is sort of readable.

I was thinking myself about using two-character piece IDs where the second is a letter that would encode the side in the usual way, but the first one would be non-alphanumeric, so that it can easily be recognized as a prefix altering the meaning of the following letter. E.g. using . , : ; as prefixes you would already have 4 x 26 possible IDs. This is far less than the 26x26 that can be achieved with Don's proposal, but enough for anything but the very largest (some would say 'insane') variants. The prefixes would have little optical density, and naturally act as separators to enhance readability. The Chu Shogi start position in this notation could look like:

.l,l.c.s.g.k.e.g.s.c,l.l/,r1.b1.t,p:k.t1.b1,r/,s.v.r.h.d;f;l.d.h.r.v,s/.p.p.p.p.p.p.p.p.p.p.p.p/3,g4,g3/12/12/3,G4,G3/.P.P.P.P.P.P.P.P.P.P.P.P/,S.V.R.H.D;L;F.D.H.R.V,S/,R1.B1.T:K,P.T1.B1,R/.L,L.C.S.G.E.K.G.S.C,L.L w

where .L would mean Lance but ,L would mean Ferocious Leopard, etc. I guess it might be better to also allow pieces without prefix, and with a space prefix

l.lcsgkegsc.ll/.r1b1t.p:kt1b1.r/.svrhd;f;ldhrv.s/pppppppppppp/3.g4.g3/12/12/3.G4.G3/PPPPPPPPPPPP/.SVRHD;L;FDHRV.S/.R1B1T:K.PT1B1.R/L.LCSGEKGSC.LL w

I think Don's proposal is better. It is also easily extendible to games with more than two players. The downside is that there is no backward compatibility with the FEN standard for Chess.
One has to also decide whether concise encoding is the primary goal or not. If fen is primarily for humans (which presumably forsyth notation was indeed) then consideration should be given for that, if it's for GUI's and computers it's a different consideration. Fen is not very natural for parsing by computer - it's not that difficult but it's tedious and illogical for computers. It's rare that a human hand enters fen notation but I have done so from time to time.
Capital punishment would be more effective as a preventive measure if it were administered prior to the crime.
User avatar
hgm
Posts: 28353
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: FEEN?

Post by hgm »

Well, WinBoard/XBoard does allow you to type a FEN in Edit Position mode, and doing so for a complex position can actually be very competitive to using the mouse and the piece menu. Certainly if the menu would become huge. Let's face it: there is no easy way to enter a dense position on a 25x25 board.

So I think I will go for the separated-sides notation in XBoard. Perhaps with some extra leading character to make it immediately obvious to the parser that this is not an ordinary FEN. We could call it Dailey-Edwards-Muller Notation (DEMN!) :idea:
User avatar
Don
Posts: 5106
Joined: Tue Apr 29, 2008 4:27 pm

Re: FEEN?

Post by Don »

hgm wrote:Well, WinBoard/XBoard does allow you to type a FEN in Edit Position mode, and doing so for a complex position can actually be very competitive to using the mouse and the piece menu. Certainly if the menu would become huge. Lets face it: there is no easy way to enter a dense position on a 25x25 board.

So I think I will go for the separated-sides notation in XBoard. Perhaps with some extra leading character to make it immediately obvious to the parser that this is not an ordinary FEN. We could call it Dailey-Edwards-Muller Notation (DEMN!) :idea:
It's a good thing Steven Edwards was not born Steven Ackerman!

I am a command line junkie myself, I LOVE the keyboard and despise working with the mouse. Although I use the Linux windows managers I am only a short step away from doing away with that and using only the console - but that is no longer practical since I get a lot of documentation on the web when doing software development.

The nice thing about Linux is that you have a number of virtual consoles and by using utlities such as "screen" you can get as many separate consoles as you would ever want.
Capital punishment would be more effective as a preventive measure if it were administered prior to the crime.
cyril
Posts: 5
Joined: Mon Sep 02, 2013 6:46 pm

Re: FEEN?

Post by cyril »

Thank you all for your interest to the FEEN format! I'm glad I read opinions, even objections.
Gerd Isenberg wrote:Cyril Wack has proposed the so called "Forsyth-Edwards Expanded Notation" for cross-board and cross-style computer chess applications, that is for Shogi, Western, Xiangqi and for more than two dimensions, e.g. 3D chess.
Yes, because it's cross-style, Shogi, Western, Xiangqi, and even more exotic chess games could be compatibles.
It's also cross-board so board can be n-dimensional (from 1 to ∞), whatever the size of each dimension.
melajara
Posts: 213
Joined: Thu Dec 16, 2010 4:39 pm

Re: FEEN?

Post by melajara »

hgm wrote: For many years the Sons of Asia have learned and used a non-native character set; shouldn't the Sons of Europe now act reciprocally?
Are you seriously considering that trading 26 characters for up to 80'000 is a fair "reciprocal" exchange?

And I thought you were extolling the virtues of terse notations :lol:
Per ardua ad astra
cyril
Posts: 5
Joined: Mon Sep 02, 2013 6:46 pm

Re: FEEN?

Post by cyril »

hgm wrote:I can confirm that I was not involved. After glancing to the proposal, my first impression is that it is rather absurd. I am not sure what problem the inventor is trying to solve with this.
The goal of this format is to describe a particular board position of a two-players cross-board and cross-style chess game.
hgm wrote:Especially putting a 'style' prefix on every piece name seems a very counter-productive way of doing things.
As well as FEN use algebraic notation's piece naming, in FEEN, piece naming come from PCN. The reason is that, inside chess variants, there's a lot of different pieces which sometime have the same name and the same abbreviation. As we could imagine, without a style prefix, collisions may occur.
Sure, this extends the size of the piece name and, by extension, it also extends the size of FEEN strings. We could certainly find some other way to compress more. However, thus, parsing remains easy.
hgm wrote:In a FEEN for Chess all pieces would need a w: or W: prefix to indicate the following piece ID refers to orthodox Chess ('western style'). As one almost never deals with games that mix pieces of different games (and if they do, usually have many original new piece types which would not exist in any style), this seems extremely wasteful.
Yes that's true, I agree with you. For instance, in a chess game with two Western players, the FEN standard should be used and I recommend it. Here, using a long FEEN string would be extremely wasteful. Even if its board fingerprint of 256-bits can always help to identify positions, especially in database.
hgm wrote:If some clarification would be needed as to what the letters in a FEN-like notation mean, it would be much better to express that in a single prefix to the entire FEN, naming the variant. Like xiangqi: or xq:.
Yes, this would be great. By this way, the style name could be centralized, following "Don't Repeat Yourself" principe. In some cases however, collisions may occur, despite the use of uppercase and lowercase.
Let's consider for instance a game with a Western player against a Shogi player, where at the beginning there are Western pawns with "P" abbreviation and Shogi pawns with "p" abbreviation. Everything is fine. Until a "P" is captured.
User avatar
hgm
Posts: 28353
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: FEEN?

Post by hgm »

melajara wrote:
hgm wrote: For many years the Sons of Asia have learned and used a non-native character set; shouldn't the Sons of Europe now act reciprocally?
Are you seriously considering that trading 26 characters for up to 80'000 is a fair "reciprocal" exchange?

And I thought you were extolling the virtues of terse notations :lol:
Note that I did not write that. You are quoting Steven here.
User avatar
hgm
Posts: 28353
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: FEEN?

Post by hgm »

cyril wrote:The goal of this format is to describe a particular board position of a two-players cross-board and cross-style chess game.
WinBoard has done that for years using UFEN. Which is much more compact, better readable and backward compatible to ordinary FEN.
As well as FEN use algebraic notation's piece naming, in FEEN, piece naming come from PCN. The reason is that, inside chess variants, there's a lot of different pieces which sometime have the same name and the same abbreviation. As we could imagine, without a style prefix, collisions may occur.
You say the goal of FEEN is to describe a position. But from this it turns out that in fact the goal is much more ambitious: you want the FEEN to explain the rules of the game as well. Otherwise there would be no need to distinguish a FIDE Pawn from a Shogi Pawn from a Xiangqi Pawn from a Capablanca Pawn from a Janus Pawn from a Suicide Pawn, when it is the only kind of Pawn occurring in its game...

I had this discussion before with Reinhardt Scharnagl (the inventor of the X-FEN standard), in connection to the notation of castling rights in FENs for Janus Chess. He wanted to use other letters than Kk because on K-side castling the King moves from e1 to i1 (rather than the usual 3 squares on a 10-wide board). So that you could see from the FEN alone that you were dealing with Janus Chess rather than a similar position from Capablanca Random Chess. But these are quite distinct goals:
1) encode the rules of a game / chess variant
2) encode the board position of a game of known rules

Obviously (1) needs to convey far more information, and thus will lead to a much more cumbersome notation. But you almost always want to do (2): positions tend to be grouped in files for homogeneous use (as starting positions for testing engines, as final positions from games of a match etc.) and the context makes it clear for which variant they are, for all at once. Trying to put variant-identifying info in the position diagram would be extremely wasteful.

I dislike FEEN because it is a half-hearted attempt at (1). Half-hearted, because it still would have grave difficulty encoding all rules of a variant. Like the baring rule of Shatranj, the Lion-capture rules of Chu Shogi, the repetition rule of mini-Shogi... Extending it to do all that would lead to a very large number of ad-hoc notations for single-time use. It would be much more efficient to simply say "this is Chu Shogi" (e.g. by a "chu:" prefix to UFEN than to try to sum up a multitude of traits that no other existing Chess variant than Chu Shogi has.
Let's consider for instance a game with a Western player against a Shogi player, where at the beginning there are Western pawns with "P" abbreviation and Shogi pawns with "p" abbreviation. Everything is fine. Until a "P" is captured.
Indeed. They are different piece types, and thus, when occurring in the same game they should have different piece ID. In WinBoard I would simply assign the letter S to Shogi Pawns, and it would be no problem at all to use ordinary (U)FEN. If you want to make the promotion rules transfer to the other side with the piece (it is not obvious to me this makes sense, but the rules could be anything) the Shogi Rook would also be a different piece type than the FIDE Rook, and I would use a C ('Chariot') for that, etc. In Spartan Chess, for instance, the Hoplite Pawn of the Spartan army is encoded by H, the FIDE Pawns of the Persians by P. In Chess with Different Armies all Pawns are encoded by P (moving as ordinary FIDE Pawns), despite the fact that they have different promotion rules. (But of course there is no ambiguity, as it is not a drop game, and they would never change sides.) No problem as long as you don't exceed 26 piece types. And when you do, prefixing by a style will not in generally solve it, as Taikyoku-Shogi style alone would need hundreds of piece types.

I gave up the idea that piece types should be encoded the same in FEN (or SAN) in every variant by a universal symbol pretty quickly. It is just not practical. Never forget the maximum-flexibility-minimum-usefulness principle!
melajara
Posts: 213
Joined: Thu Dec 16, 2010 4:39 pm

Re: FEEN?

Post by melajara »

hgm wrote:
melajara wrote:
hgm wrote: For many years the Sons of Asia have learned and used a non-native character set; shouldn't the Sons of Europe now act reciprocally?
Are you seriously considering that trading 26 characters for up to 80'000 is a fair "reciprocal" exchange?

And I thought you were extolling the virtues of terse notations :lol:
Note that I did not write that. You are quoting Steven here.
Indeed, sorry
Per ardua ad astra