Version Yard documentation CI RuboCop License

FEEN (FEN Easy Extensible Notation) support for the Ruby language.


This is an implementation of FEEN, a generic format that can be used for serializing and deserializing chess positions.

The main chess variants may be supported, including Chess, Janggi, Makruk, Shogi, Xiangqi.

More exotic variants may be also supported, like: Dai dai shogi, Four-player chess, or Three-dimensional chess 🖖

3D chess on Star Trek (from the episode "Court Martial")


Add this line to your application's Gemfile:

gem "feen"

And then execute:

bundle install

Or install it yourself as:

gem install feen


require "feen"

# Dump a classic Tsume Shogi problem
  in_hand: %w[S r r b g g g g s n n n n p p p p p p p p p p p p p p p p p],
  shape:   [9, 9],
  side_id: 0,
  square:  {
    3  => "s",
    4  => "k",
    5  => "s",
    22 => "+P",
    43 => "+B"
# => "3,s,k,s,3/9/4,+P,4/9/7,+B,1/9/9/9/9 0 S,b,g,g,g,g,n,n,n,n,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,r,r,s"

# Parse a classic Tsume Shogi problem
FEEN.parse("3,s,k,s,3/9/4,+P,4/9/7,+B,1/9/9/9/9 0 S,b,g,g,g,g,n,n,n,n,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,r,r,s")
# => {:square=>{3=>"s", 4=>"k", 5=>"s", 22=>"+P", 43=>"+B"}, :shape=>[9, 9], :in_hand=>["S", "b", "g", "g", "g", "g", "n", "n", "n", "n", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "r", "r", "s"], :side_id=>0}


The code is available as open source under the terms of the MIT License.

About Sashité

This gem is maintained by Sashité.

With some lines of code, let's share the beauty of Chinese, Japanese and Western cultures through the game of chess!