Notation

# Flang Notations

## Version 2

### FMN (Flang Move Notation)

FMNv1 strings are still valid FMNv2 strings.

How to get form FMNv1 to v2:

Let's take `PC1-B2` as an example. It is completely valid but it contains redundant information.

1. remove the minus -> `PC1B2`
2. may be lower case (optional) -> `pc1b2` or `Pc1b2` (to point out it's a white pawn) or `PC1B2`
3. eliminate the from position if possible -> `pb2`
4. eliminate the piece type if possible -> `b2`

More examples:

• `PG2-H3` -> `g2h3` (from position cannot be eliminated, piece type can)
• `UG1-F3` -> `Uf3`

How to parse:

• length=2 -> find possible moves to target with current color
• length=3 -> find possible move to target with current color using the specified piece type
• length=4 -> parse from -> to
• length=5 -> use Version 1 parsing

A game can be encoded into an FMN string with the moves separated by a space.

Example: `g2h3 b7b6 f7 hf7 Hg2 f6 b2 g7 a1 pg5 c1 pe6 b2b3 uc6 Rb1 f5 a3 kb8 Rg1 fd7 c2d3 kc8 Ra1 e2 g1 kd8 d1 ke8 f1 re7 Ra1 pd6`

The full game can be reconstructed from from an FMN-String. Because of that, the FMN notation is the default notation.

### FBN (Flang Board Notation)

Example: `+R-4K5P1PHPUP1P3P13pp2pup-4p2frhp5k3`

How to get from FBNv1 to v2:

1. remove all the plusses -> pieces are unfreezed by default
2. replace spaces by a number which represents the number of spaces
3. the first character specifies the color that can move next + for white and - for black

How to parse:

• first chat = color at move
• iterate through tokens (letter, number, minus)
• letter: add piece to current location
• number: offset board by the specified number
• minus: freeze last piece

The FBN contains the current board state but no information about the history of the game.

## Version 1

### FMN (Flang Move Notation)

FMN strings consist of move notations separated by a space.

Move notation: `PG2-H3` = white pawn at G2 move to H3

Example: `PG2-H3 pB7-B6 FF1-F7 hD8-F7 HE1-G2 pE7-F6 PC1-B2 pF8-G7 RD1-A1 pF6-G5 UG1-C1 pD7-E6 PB2-B3 uB8-C6 RA1-B1 pE6-F5 UC1-A3 kA8-B8 RB1-G1 fC8-D7 PC2-D3 kB8-C8 RG1-A1 rE8-E2 KH1-G1 kC8-D8 RA1-D1 kD8-E8 KG1-F1 rE2-E7 RD1-A1 pC7-D6`

The full game can be reconstructed from from an FMN-String. Because of that, the FMN notation is the default notation.

### FBN (Flang Board Notation)

Example: `R- + + + +K+ + + + + +P+ +P+H+P+U+P+ +P+ + + +P+ + + + + + + + + + + + + +p+p+ + +p+u+p- + + + +p+ + +f+r+h+p+ + + + + +k+ + + +`

The FBN contains the current board state but no information about the history of the game.