GithubHelp home page GithubHelp logo

sashite / feen.cr Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 52 KB

FEEN support for the Crystal language.

Home Page: https://developer.sashite.com/specs/forsyth-edwards-expanded-notation

License: MIT License

Crystal 100.00%
chess fen chess-position shogi xiangqi sfen chess-variant chess-variants janggi makruk

feen.cr's Introduction

FEEN.cr

Build Status

FEEN (Forsyth–Edwards Expanded Notation) support for the Crystal language.

Overview

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

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

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

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

Installation

  1. Add the dependency to your shard.yml:

    dependencies:
      feen:
        github: sashite/feen.cr
  2. Run shards install

Usage

require "feen"

# Dump a classic Tsume Shogi problem
FEEN.dump(
  "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}

License

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

About Sashite

This library is maintained by Sashite.

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

feen.cr's People

Contributors

cyril avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.