Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tlehman/fenparser
a parser for Forsyth-Edwards Notation (for encoding chess positions)
https://github.com/tlehman/fenparser
Last synced: about 1 month ago
JSON representation
a parser for Forsyth-Edwards Notation (for encoding chess positions)
- Host: GitHub
- URL: https://github.com/tlehman/fenparser
- Owner: tlehman
- Created: 2015-07-08T03:46:21.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2015-07-08T04:52:59.000Z (almost 9 years ago)
- Last Synced: 2024-02-12T04:35:48.876Z (5 months ago)
- Language: Python
- Size: 133 KB
- Stars: 14
- Watchers: 2
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Lists
- awesome-chess - fenparser by tlehman - A parser for Forsyth-Edwards Notation wriitten in Python. (Uncategorized / Uncategorized)
README
# FEN Parser
Forsyth-Edwards Notation (FEN) describes a chess position.
In a single line of ASCII text, it describes all the information
about the state of a game.# Examples
Here is an example FEN string: `8/5N2/4p2p/5p1k/1p4rP/1P2Q1P1/P4P1K/5q2 w - - 15 44`
And here is the position it describes:
![chess-position-1.png](chess-position-1.png)
Breaking down our example FEN string a bit:
```
castling ability
| en passant target square
| |
| | fullmove counter
v v v
8/5N2/4p2p/5p1k/1p4rP/1P2Q1P1/P4P1K/5q2 w - - 15 44
| | ^ ^
------------------------------------- | L halfmove clock
|__ piece placement |
Side to move (white)
```
# GrammarThis is the BNF grammar that describes the FEN notation:
```
::=
' '
' '
' '
' '
' '::= '/''/''/''/''/''/''/'
::= [] {[]} [] | '8'
::= |
::= '1' | '2' | '3' | '4' | '5' | '6' | '7'
::= 'P' | 'N' | 'B' | 'R' | 'Q' | 'K'
::= 'p' | 'n' | 'b' | 'r' | 'q' | 'k'::= {'w' | 'b'}
::= '-' | ['K'] ['Q'] ['k'] ['q'] (1..4)
::= '-' |
::=
::= 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h'
::= '3' | '6'::= {}
::= '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9'```
For more information about what all these thinngs mean, check out the [Forsyth-Edwards Notation page on the Chess programming wiki](http://chessprogramming.wikispaces.com/Forsyth-Edwards+Notation)
# References
- http://chessprogramming.wikispaces.com/Forsyth-Edwards+Notation
- http://humanchimp.neocities.org/starting-position.html?8/5N2/4p2p/5p1k/1p4rP/1P2Q1P1/P4P1K/5q2%20w%20-%20-%2015%2044