Module: Sashite::GAN

Defined in:
lib/sashite/gan.rb,
lib/sashite/gan/abbr.rb,
lib/sashite/gan/error.rb,
lib/sashite/gan/piece.rb,
lib/sashite/gan/parser.rb,
lib/sashite/gan/error/type.rb,
lib/sashite/gan/error/style.rb,
lib/sashite/gan/error/string.rb

Overview

The GAN (General Actor Notation) module.

Defined Under Namespace

Modules: Error, Parser Classes: Abbr, Piece

Constant Summary collapse

SEPARATOR_CHAR =
':'

Class Method Summary collapse

Class Method Details

.parse(string) ⇒ Piece

Parse the GAN string into a Ruby object structure and return it.

Examples:

Chess (Western chess)‘s Rook, White

GAN.parse("C:R")

Chess (Western chess)‘s King, Black

GAN.parse("c:-k")

Makruk (Thai chess)‘s Bishop, White

GAN.parse("M:B")

Shogi (Japanese chess)‘s King, Gote

GAN.parse("s:-k")

Shogi (Japanese chess)‘s King, Sente

GAN.parse("S:-K")

Shogi (Japanese chess)‘s promoted Pawn, Sente

GAN.parse("S:+P")

Xiangqi (Chinese chess)‘s General, Red

GAN.parse("X:-G")

Xiangqi (Chinese chess)‘s Flying General, Red

GAN.parse("X:+-G")

Dai Dai Shogi (huge Japanese chess)‘s Phoenix, Sente

GAN.parse("DAI_DAI_SHOGI:PH")

Another FOO chess variant’s promoted Z piece, Bottom-side

GAN.parse("FOO:+Z")

Returns:

  • (Piece)

    An instance of the piece.



45
46
47
# File 'lib/sashite/gan.rb', line 45

def self.parse(string)
  Parser.call(string)
end