DEV Community

Corey Alexander
Corey Alexander Subscriber

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.

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read more

Top comments (0)

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

👋 Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay