DEV Community

Corey Alexander
Corey Alexander

Posted on • Originally published at coreyja.com on

TIL: FEN Chess Notation and Battlesnake

TIL about FEN Chess notation, a text representation of the state of a chess board.Wikipedia

Here is the starting position of a chess board in FEN

rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
Enter fullscreen mode Exit fullscreen mode

The first of the six sections separated by spaces is the board. The letters represent the pieces: uppercase is white, and lowercase is black. The numbers represent empty squares in a row. Each / is the end of a row of the board.

The sections after the board state say which colors turn it is. And then rules for castling, en passant and other rules that I need help understanding as a non-chess player.


As a Battlesnake developer, we get a lot of chess cross-over, which is where FEN was introduced to me. In the Battlesnake Discord, someone asked if there was a FEN-like representation of a Battlesnake board. The consensus was there isn't today. But I don't like that answer! Fen seems cool, and it would be great if Battlesnake had a more concise way to express board states than the full JSON payloads.

I'm going to start thinking about what this format would look like! If you have thoughts on how it should work, let me know! It will be more difficult for battlesnake, but it will be a fun problem to noodle on.

This post was inspired by EnderInvader's battlesnake viewer Obsidian plugin: https://github.com/EnderInvader/battlesnake-viewerIt's a fork of a chess viewer that visualizes FEN notation. EnderInvader's version takes the game JSON and renders a version of the Battlesnake Board! It's cool, and if you use Obsidian, you should check it out.

Top comments (0)