sashite-gan 0.0.1 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 7290bdd98bab0d141cef6f7ed05b515d51175657
4
- data.tar.gz: c699426a9dcc7530b714d1272735ec002d023078
2
+ SHA256:
3
+ metadata.gz: 7ebee55a8937fadf15f9b2a4bcf03e672b96f832cd01482be1c0374a1314fb21
4
+ data.tar.gz: 3f092d4f12e0b6a2e20d8981c76fad2be914a886a37ca95cb4d3437b9f18e67a
5
5
  SHA512:
6
- metadata.gz: 6d008347910accfd80e61f883011f4eb5b1a705aa850214c6f9a33f2ac0087f12d3f70a741d59fe043902a60d159d1e1c60398358fc272027861ca49fa47a433
7
- data.tar.gz: e9b488691546b34fc43875035a940eb3192ad001f4a99f23fb1e6fe2d102de45417409ec0ec9d1022083dcb55bfbeb3bc6d33cf0f8246b92a3104fefe39871cf
6
+ metadata.gz: 472262b63c2401d6392dd65b1e39ca0600515b201cce85fcbbbacf8d245256b978c143d7313c23495cc143cf42c79a6631690a0f0eab51c0a9bf8a78cd64a259
7
+ data.tar.gz: a5afb55bc54194750b0406646e0074a08f9dd5952f3c743c411a94b1cfa183aa263e7cb7b393fffce542ce5c2adf385f82ac5322e4ddfbfeb843d4a9ae0c063d
data/LICENSE.md CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2014 Cyril Wack
1
+ Copyright (c) 2014-2020 Sashite
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -1,38 +1,181 @@
1
- # Sashite::GAN
1
+ # GAN.rb
2
2
 
3
- Implementation of [General Actor Notation](//sashite-wiki.herokuapp.com/General_Actor_Notation) for storing actors from abstract strategy games.
3
+ [![Build Status](https://travis-ci.org/sashite/gan.rb.svg?branch=master)](https://travis-ci.org/sashite/gan.rb)
4
4
 
5
- ## Status
6
-
7
- [![Gem Version](https://badge.fury.io/rb/sashite-gan.svg)](//badge.fury.io/rb/sashite-gan)
8
- [![Build Status](https://secure.travis-ci.org/sashite/gan.rb.svg?branch=master)](//travis-ci.org/sashite/gan.rb?branch=master)
5
+ > A Ruby interface for data serialization in [General Actor Notation](https://developer.sashite.com/specs/general-actor-notation) format ♟️
9
6
 
10
7
  ## Installation
11
8
 
12
- Add this line to your application's Gemfile:
9
+ 1. Add the dependency to your `Gemfile`:
10
+
11
+ ```ruby
12
+ gem 'sashite-gan'
13
+ ```
13
14
 
14
- gem 'sashite-gan'
15
+ 2. Run `bundle install`
15
16
 
16
- And then execute:
17
+ ## Usage
17
18
 
18
- $ bundle
19
+ ```ruby
20
+ require 'sashite-gan'
19
21
 
20
- Or install it yourself as:
21
22
 
22
- $ gem install sashite-gan
23
+ # Chess (Western chess)'s Rook, White
24
+ piece = Sashite::GAN.parse("C:R")
23
25
 
24
- ## Usage
26
+ piece.abbr.to_s # => "R"
27
+ piece.style # => "C"
28
+ piece.topside? # => false
29
+ piece.bottomside? # => true
30
+ piece.to_s # => "C:R"
31
+ piece.topside.to_s # => "c:r"
32
+ piece.bottomside.to_s # => "C:R"
33
+ piece.oppositeside.to_s # => "c:r"
34
+ piece.promote.to_s # => "C:+R"
35
+ piece.unpromote.to_s # => "C:R"
36
+
37
+
38
+ # Chess (Western chess)'s King, Black
39
+ piece = Sashite::GAN.parse("c:-k")
40
+
41
+ piece.abbr.to_s # => "-k"
42
+ piece.style # => "c"
43
+ piece.topside? # => true
44
+ piece.bottomside? # => false
45
+ piece.to_s # => "c:-k"
46
+ piece.topside.to_s # => "c:-k"
47
+ piece.bottomside.to_s # => "C:-K"
48
+ piece.oppositeside.to_s # => "C:-K"
49
+ piece.promote.to_s # => "c:+-k"
50
+ piece.unpromote.to_s # => "c:-k"
51
+
52
+
53
+ # Makruk (Thai chess)'s Bishop, White
54
+ piece = Sashite::GAN.parse("M:B")
55
+
56
+ piece.abbr.to_s # => "B"
57
+ piece.style # => "M"
58
+ piece.topside? # => false
59
+ piece.bottomside? # => true
60
+ piece.to_s # => "M:B"
61
+ piece.topside.to_s # => "m:b"
62
+ piece.bottomside.to_s # => "M:B"
63
+ piece.oppositeside.to_s # => "m:b"
64
+ piece.promote.to_s # => "M:+B"
65
+ piece.unpromote.to_s # => "M:B"
66
+
67
+
68
+ # Shogi (Japanese chess)'s King, Gote
69
+ piece = Sashite::GAN.parse("s:-k")
70
+
71
+ piece.abbr.to_s # => "-k"
72
+ piece.style # => "s"
73
+ piece.topside? # => true
74
+ piece.bottomside? # => false
75
+ piece.to_s # => "s:-k"
76
+ piece.topside.to_s # => "s:-k"
77
+ piece.bottomside.to_s # => "S:-K"
78
+ piece.oppositeside.to_s # => "S:-K"
79
+ piece.promote.to_s # => "s:+-k"
80
+ piece.unpromote.to_s # => "s:-k"
81
+
82
+
83
+ # Shogi (Japanese chess)'s King, Sente
84
+ piece = Sashite::GAN.parse("S:-K")
85
+
86
+ piece.abbr.to_s # => "-K"
87
+ piece.style # => "S"
88
+ piece.topside? # => false
89
+ piece.bottomside? # => true
90
+ piece.to_s # => "S:-K"
91
+ piece.topside.to_s # => "s:-k"
92
+ piece.bottomside.to_s # => "S:-K"
93
+ piece.oppositeside.to_s # => "s:-k"
94
+ piece.promote.to_s # => "S:+-K"
95
+ piece.unpromote.to_s # => "S:-K"
96
+
97
+
98
+ # Shogi (Japanese chess)'s promoted Pawn, Sente
99
+ piece = Sashite::GAN.parse("S:+P")
100
+
101
+ piece.abbr.to_s # => "+P"
102
+ piece.style # => "S"
103
+ piece.topside? # => false
104
+ piece.bottomside? # => true
105
+ piece.to_s # => "S:+P"
106
+ piece.topside.to_s # => "s:+p"
107
+ piece.bottomside.to_s # => "S:+P"
108
+ piece.oppositeside.to_s # => "s:+p"
109
+ piece.promote.to_s # => "S:+P"
110
+ piece.unpromote.to_s # => "S:P"
111
+
112
+
113
+ # Xiangqi (Chinese chess)'s General, Red
114
+ piece = Sashite::GAN.parse("X:-G")
115
+
116
+ piece.abbr.to_s # => "-G"
117
+ piece.style # => "X"
118
+ piece.topside? # => false
119
+ piece.bottomside? # => true
120
+ piece.to_s # => "X:-G"
121
+ piece.topside.to_s # => "x:-g"
122
+ piece.bottomside.to_s # => "X:-G"
123
+ piece.oppositeside.to_s # => "x:-g"
124
+ piece.promote.to_s # => "X:+-G"
125
+ piece.unpromote.to_s # => "X:-G"
126
+
127
+
128
+ # Xiangqi (Chinese chess)'s Flying General, Red
129
+ piece = Sashite::GAN.parse("X:+-G")
130
+
131
+ piece.abbr.to_s # => "+-G"
132
+ piece.style # => "X"
133
+ piece.topside? # => false
134
+ piece.bottomside? # => true
135
+ piece.to_s # => "X:+-G"
136
+ piece.topside.to_s # => "x:+-g"
137
+ piece.bottomside.to_s # => "X:+-G"
138
+ piece.oppositeside.to_s # => "x:+-g"
139
+ piece.promote.to_s # => "X:+-G"
140
+ piece.unpromote.to_s # => "X:-G"
141
+
142
+
143
+ # Dai Dai Shogi (huge Japanese chess)'s Phoenix, Sente
144
+ piece = Sashite::GAN.parse("DAI_DAI_SHOGI:PH")
145
+
146
+ piece.abbr.to_s # => "PH"
147
+ piece.style # => "DAI_DAI_SHOGI"
148
+ piece.topside? # => false
149
+ piece.bottomside? # => true
150
+ piece.to_s # => "DAI_DAI_SHOGI:PH"
151
+ piece.topside.to_s # => "dai_dai_shogi:ph"
152
+ piece.bottomside.to_s # => "DAI_DAI_SHOGI:PH"
153
+ piece.oppositeside.to_s # => "dai_dai_shogi:ph"
154
+ piece.promote.to_s # => "DAI_DAI_SHOGI:+PH"
155
+ piece.unpromote.to_s # => "DAI_DAI_SHOGI:PH"
156
+
157
+
158
+ # A random FOO chess variant's promoted Z piece, Bottom-side
159
+ piece = Sashite::GAN.parse("FOO:+Z")
160
+
161
+ piece.abbr.to_s # => "+Z"
162
+ piece.style # => "FOO"
163
+ piece.topside? # => false
164
+ piece.bottomside? # => true
165
+ piece.to_s # => "FOO:+Z"
166
+ piece.topside.to_s # => "foo:+z"
167
+ piece.bottomside.to_s # => "FOO:+Z"
168
+ piece.oppositeside.to_s # => "foo:+z"
169
+ piece.promote.to_s # => "FOO:+Z"
170
+ piece.unpromote.to_s # => "FOO:Z"
171
+ ```
172
+
173
+ ## License
25
174
 
26
- require 'sashite-gan'
175
+ The code is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
27
176
 
28
- actor = Sashite::GAN::Actor.new 2,
29
- 'bc096c4c7f48fc5c4c162555e4df98169e204aea', 'top', 'xianqi', 'rook'
30
- actor.to_gan # => '2:bc096c4c7f48fc5c4c162555e4df98169e204aea:top:xianqi:rook'
177
+ ## About Sashite
31
178
 
32
- ## Contributing
179
+ This [gem](https://rubygems.org/gems/sashite-gan) is maintained by [Sashite](https://sashite.com/).
33
180
 
34
- 1. Fork it
35
- 2. Create your feature branch (`git checkout -b my-new-feature`)
36
- 3. Commit your changes (`git commit -am 'Add some feature'`)
37
- 4. Push to the branch (`git push origin my-new-feature`)
38
- 5. Create a new Pull Request
181
+ With some [lines of code](https://github.com/sashite/), let's share the beauty of Chinese, Japanese and Western cultures through the game of chess!
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Sashite namespace
4
+ module Sashite; end
5
+
6
+ require_relative 'sashite/gan'
@@ -1,25 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'gan/parser'
4
+
1
5
  module Sashite
6
+ # The GAN (General Actor Notation) module.
7
+ #
8
+ # @see https://developer.sashite.com/specs/general-actor-notation
2
9
  module GAN
3
- class Actor
4
- attr_accessor :dimension, :cgh, :side, :variant, :name
5
-
6
- def initialize dimension, cgh, side, variant, name
7
- @dimension = dimension
8
- @cgh = cgh
9
- @side = side
10
- @variant = variant
11
- @name = name
12
- end
10
+ SEPARATOR_CHAR = ':'
13
11
 
14
- def to_gan
15
- [
16
- @dimension,
17
- @cgh,
18
- @side,
19
- @variant,
20
- @name
21
- ].join ':'
22
- end
12
+ # Parse the GAN string into a Ruby object structure and return it.
13
+ #
14
+ # @example Chess (Western chess)'s Rook, White
15
+ # GAN.parse("C:R")
16
+ #
17
+ # @example Chess (Western chess)'s King, Black
18
+ # GAN.parse("c:-k")
19
+ #
20
+ # @example Makruk (Thai chess)'s Bishop, White
21
+ # GAN.parse("M:B")
22
+ #
23
+ # @example Shogi (Japanese chess)'s King, Gote
24
+ # GAN.parse("s:-k")
25
+ #
26
+ # @example Shogi (Japanese chess)'s King, Sente
27
+ # GAN.parse("S:-K")
28
+ #
29
+ # @example Shogi (Japanese chess)'s promoted Pawn, Sente
30
+ # GAN.parse("S:+P")
31
+ #
32
+ # @example Xiangqi (Chinese chess)'s General, Red
33
+ # GAN.parse("X:-G")
34
+ #
35
+ # @example Xiangqi (Chinese chess)'s Flying General, Red
36
+ # GAN.parse("X:+-G")
37
+ #
38
+ # @example Dai Dai Shogi (huge Japanese chess)'s Phoenix, Sente
39
+ # GAN.parse("DAI_DAI_SHOGI:PH")
40
+ #
41
+ # @example Another FOO chess variant's promoted Z piece, Bottom-side
42
+ # GAN.parse("FOO:+Z")
43
+ #
44
+ # @return [Piece] An instance of the piece.
45
+ def self.parse(string)
46
+ Parser.call(string)
23
47
  end
24
48
  end
25
49
  end
@@ -0,0 +1,76 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Sashite
4
+ module GAN
5
+ # The piece's abbreviation.
6
+ class Abbr
7
+ # The piece's type.
8
+ #
9
+ # @!attribute [r] type
10
+ # @return [String] The type of the piece.
11
+ attr_reader :type
12
+
13
+ def initialize(type, is_promoted:, is_king:)
14
+ @type = TypeString(type)
15
+ @is_promoted = Boolean(is_promoted)
16
+ @is_king = Boolean(is_king)
17
+
18
+ freeze
19
+ end
20
+
21
+ # @return [Boolean] Is the piece a king?
22
+ def king?
23
+ @is_king
24
+ end
25
+
26
+ # @return [Boolean] Is the piece promoted?
27
+ def promoted?
28
+ @is_promoted
29
+ end
30
+
31
+ # @return [String] The abbreviation of the piece.
32
+ def to_s
33
+ str = type
34
+ str = "-#{str}" if king?
35
+ str = "+#{str}" if promoted?
36
+ str
37
+ end
38
+
39
+ def inspect
40
+ to_s
41
+ end
42
+
43
+ def ==(other)
44
+ other.to_s == to_s
45
+ end
46
+
47
+ def eql?(other)
48
+ self == other
49
+ end
50
+
51
+ private
52
+
53
+ # rubocop:disable Naming/MethodName
54
+
55
+ # Ensures `arg` is a boolean, and returns it. Otherwise, raises a
56
+ # `TypeError`.
57
+ def Boolean(arg)
58
+ raise ::TypeError, arg.class.inspect unless [false, true].include?(arg)
59
+
60
+ arg
61
+ end
62
+
63
+ # Ensures `arg` is a type, and returns it. Otherwise, raises an error.
64
+ def TypeString(arg)
65
+ raise ::TypeError, arg.class.inspect unless arg.is_a?(::String)
66
+ raise Error::Type, arg.inspect unless arg.match?(/\A[a-z]{1,2}\z/i)
67
+
68
+ arg
69
+ end
70
+
71
+ # rubocop:enable Naming/MethodName
72
+ end
73
+ end
74
+ end
75
+
76
+ require_relative 'error'
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Sashite
4
+ module GAN
5
+ # The error namespace.
6
+ module Error; end
7
+ end
8
+ end
9
+
10
+ Dir[File.join(File.dirname(__FILE__), 'error', '*.rb')].each do |fname|
11
+ require_relative fname
12
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Sashite
4
+ module GAN
5
+ module Error
6
+ # `String` is the base class for GAN string errors.
7
+ class String < ::StandardError; end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'string'
4
+
5
+ module Sashite
6
+ module GAN
7
+ module Error
8
+ # Raised when encountering an invalid sequence of characters.
9
+ class Style < String; end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'string'
4
+
5
+ module Sashite
6
+ module GAN
7
+ module Error
8
+ # Raised when encountering an invalid sequence of characters.
9
+ class Type < String; end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'error'
4
+ require_relative 'piece'
5
+
6
+ module Sashite
7
+ module GAN
8
+ # The notation parser.
9
+ module Parser
10
+ def self.call(arg)
11
+ raise Error::String, "Invalid: #{arg.inspect}" unless valid?(arg)
12
+
13
+ style, abbr = arg.split(SEPARATOR_CHAR)
14
+
15
+ Piece.new(
16
+ abbr.delete('-+'),
17
+ is_king: abbr.include?('-'),
18
+ is_promoted: abbr.include?('+'),
19
+ is_topside: style.downcase.eql?(style),
20
+ style: style
21
+ )
22
+ end
23
+
24
+ def self.valid?(arg)
25
+ raise ::TypeError, arg.class.inspect unless arg.is_a?(::String)
26
+
27
+ arg.match?(/\A([a-z_]+:\+?-?[a-z]{1,2}|[A-Z_]+:\+?-?[A-Z]{1,2})\z/)
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,150 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Sashite
4
+ module GAN
5
+ # A piece abstraction.
6
+ class Piece
7
+ # The abbreviation of the piece.
8
+ #
9
+ # @!attribute [r] abbr
10
+ # @return [String] The abbreviation of the piece.
11
+ attr_reader :abbr
12
+
13
+ # The piece's style.
14
+ #
15
+ # @!attribute [r] style
16
+ # @return [String] The piece's style.
17
+ attr_reader :style
18
+
19
+ # Initialize a piece.
20
+ #
21
+ # @param type [String] The type of the piece.
22
+ # @param is_king [Boolean] Is it a King (or a Xiangqi General),
23
+ # so it could be checkmated?
24
+ # @param is_promoted [Boolean] Is it promoted?
25
+ # @param is_topside [Boolean] Is it owned by top-side player?
26
+ # @param style [String] The piece's style.
27
+ def initialize(type, is_king:, is_promoted:, is_topside:, style:)
28
+ @abbr = Abbr.new(type, is_king: is_king, is_promoted: is_promoted)
29
+ @is_topside = Boolean(is_topside)
30
+ @style = StyleString(style)
31
+
32
+ freeze
33
+ end
34
+
35
+ def king?
36
+ abbr.king?
37
+ end
38
+
39
+ # Is it owned by top-side player?
40
+ #
41
+ # @return [Boolean] Returns `true` if the top-side player own the piece,
42
+ # `false` otherwise.
43
+ def topside?
44
+ @is_topside
45
+ end
46
+
47
+ # Is it owned by bottom-side player?
48
+ #
49
+ # @return [Boolean] Returns `true` if the bottom-side player own the
50
+ # piece, `false` otherwise.
51
+ def bottomside?
52
+ !topside?
53
+ end
54
+
55
+ # @see https://developer.sashite.com/specs/general-actor-notation
56
+ # @return [String] The notation of the piece.
57
+ def to_s
58
+ topside? ? raw.downcase : raw.upcase
59
+ end
60
+
61
+ def inspect
62
+ to_s
63
+ end
64
+
65
+ # @return [Piece] The top-side side version of the piece.
66
+ def topside
67
+ topside? ? self : oppositeside
68
+ end
69
+
70
+ # @return [Piece] The bottom-side side version of the piece.
71
+ def bottomside
72
+ topside? ? oppositeside : self
73
+ end
74
+
75
+ # @return [Piece] The opposite side version of the piece.
76
+ def oppositeside
77
+ self.class.new(abbr.type,
78
+ is_king: abbr.king?,
79
+ is_promoted: abbr.promoted?,
80
+ is_topside: !topside?,
81
+ style: style
82
+ )
83
+ end
84
+
85
+ # @return [Piece] The promoted version of the piece.
86
+ def promote
87
+ self.class.new(abbr.type,
88
+ is_king: abbr.king?,
89
+ is_promoted: true,
90
+ is_topside: topside?,
91
+ style: style
92
+ )
93
+ end
94
+
95
+ # @return [Piece] The unpromoted version of the piece.
96
+ def unpromote
97
+ self.class.new(abbr.type,
98
+ is_king: abbr.king?,
99
+ is_promoted: false,
100
+ is_topside: topside?,
101
+ style: style
102
+ )
103
+ end
104
+
105
+ def ==(other)
106
+ other.to_s == to_s
107
+ end
108
+
109
+ def eql?(other)
110
+ self == other
111
+ end
112
+
113
+ private
114
+
115
+ # @return [String] The style and the abbreviation of the piece (without
116
+ # case).
117
+ def raw
118
+ params.join(SEPARATOR_CHAR)
119
+ end
120
+
121
+ # @return [Array] The style and the abbreviation of the piece.
122
+ def params
123
+ [style, abbr]
124
+ end
125
+
126
+ # rubocop:disable Naming/MethodName
127
+
128
+ # Ensures `arg` is a boolean, and returns it. Otherwise, raises a
129
+ # `TypeError`.
130
+ def Boolean(arg)
131
+ raise ::TypeError, arg.class.inspect unless [false, true].include?(arg)
132
+
133
+ arg
134
+ end
135
+
136
+ # Ensures `arg` is a style, and returns it. Otherwise, raises an error.
137
+ def StyleString(arg)
138
+ raise ::TypeError, arg.class.inspect unless arg.is_a?(::String)
139
+ raise Error::Style, arg.inspect unless arg.match?(/\A[a-z_]+\z/i)
140
+
141
+ arg
142
+ end
143
+
144
+ # rubocop:enable Naming/MethodName
145
+ end
146
+ end
147
+ end
148
+
149
+ require_relative 'abbr'
150
+ require_relative 'error'
metadata CHANGED
@@ -1,80 +1,138 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sashite-gan
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
- - Cyril Wack
7
+ - Cyril Kato
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-25 00:00:00.000000000 Z
11
+ date: 2020-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: bundler
14
+ name: brutal
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.6'
19
+ version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '1.6'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: minitest
28
+ name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '5'
33
+ version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '5'
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubocop-performance
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop-thread_safety
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
46
74
  - !ruby/object:Gem::Version
47
- version: '10'
75
+ version: '0'
48
76
  type: :development
49
77
  prerelease: false
50
78
  version_requirements: !ruby/object:Gem::Requirement
51
79
  requirements:
52
- - - "~>"
80
+ - - ">="
53
81
  - !ruby/object:Gem::Version
54
- version: '10'
55
- description: Implementation of GAN (General Actor Notation) for storing actors from
56
- abstract strategy games.
57
- email:
58
- - contact@cyril.io
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: simplecov
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: yard
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description: A Ruby interface for data serialization in GAN format ♟️
112
+ email: contact@cyril.email
59
113
  executables: []
60
114
  extensions: []
61
115
  extra_rdoc_files: []
62
116
  files:
63
- - ".gitignore"
64
- - ".travis.yml"
65
- - Gemfile
66
117
  - LICENSE.md
67
118
  - README.md
68
- - Rakefile
69
- - VERSION.semver
119
+ - lib/sashite-gan.rb
70
120
  - lib/sashite/gan.rb
71
- - sashite-gan.gemspec
72
- - test/_test_helper.rb
73
- - test/test_gan.rb
74
- homepage: https://github.com/sashite/gan.rb
121
+ - lib/sashite/gan/abbr.rb
122
+ - lib/sashite/gan/error.rb
123
+ - lib/sashite/gan/error/string.rb
124
+ - lib/sashite/gan/error/style.rb
125
+ - lib/sashite/gan/error/type.rb
126
+ - lib/sashite/gan/parser.rb
127
+ - lib/sashite/gan/piece.rb
128
+ homepage: https://developer.sashite.com/specs/general-actor-notation
75
129
  licenses:
76
130
  - MIT
77
- metadata: {}
131
+ metadata:
132
+ bug_tracker_uri: https://github.com/sashite/gan.rb/issues
133
+ documentation_uri: https://rubydoc.info/gems/sashite-gan/index
134
+ source_code_uri: https://github.com/sashite/gan.rb
135
+ wiki_uri: https://github.com/sashite/gan.rb/wiki
78
136
  post_install_message:
79
137
  rdoc_options: []
80
138
  require_paths:
@@ -83,18 +141,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
83
141
  requirements:
84
142
  - - ">="
85
143
  - !ruby/object:Gem::Version
86
- version: '0'
144
+ version: 2.3.0
87
145
  required_rubygems_version: !ruby/object:Gem::Requirement
88
146
  requirements:
89
147
  - - ">="
90
148
  - !ruby/object:Gem::Version
91
149
  version: '0'
92
150
  requirements: []
93
- rubyforge_project:
94
- rubygems_version: 2.2.2
151
+ rubygems_version: 3.1.2
95
152
  signing_key:
96
153
  specification_version: 4
97
154
  summary: A GAN implementation in Ruby.
98
- test_files:
99
- - test/_test_helper.rb
100
- - test/test_gan.rb
155
+ test_files: []
data/.gitignore DELETED
@@ -1,22 +0,0 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
- pkg
13
- rdoc
14
- spec/reports
15
- test/tmp
16
- test/version_tmp
17
- tmp
18
- *.bundle
19
- *.so
20
- *.o
21
- *.a
22
- mkmf.log
@@ -1,3 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.1.2
data/Gemfile DELETED
@@ -1,2 +0,0 @@
1
- source 'https://rubygems.org'
2
- gemspec
data/Rakefile DELETED
@@ -1,7 +0,0 @@
1
- require 'bundler/gem_tasks'
2
- require 'rake/testtask'
3
-
4
- Rake::TestTask.new do |t|
5
- end
6
-
7
- task(default: :test)
@@ -1 +0,0 @@
1
- 0.0.1
@@ -1,19 +0,0 @@
1
- Gem::Specification.new do |spec|
2
- spec.name = 'sashite-gan'
3
- spec.version = File.read('VERSION.semver')
4
- spec.authors = ['Cyril Wack']
5
- spec.email = ['contact@cyril.io']
6
- spec.summary = %q{A GAN implementation in Ruby.}
7
- spec.description = %q{Implementation of GAN (General Actor Notation) for storing actors from abstract strategy games.}
8
- spec.homepage = 'https://github.com/sashite/gan.rb'
9
- spec.license = 'MIT'
10
-
11
- spec.files = `git ls-files -z`.split("\x0")
12
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
13
- spec.test_files = spec.files.grep(%r{^test/})
14
- spec.require_paths = ['lib']
15
-
16
- spec.add_development_dependency 'bundler', '~> 1.6'
17
- spec.add_development_dependency 'minitest', '~> 5'
18
- spec.add_development_dependency 'rake', '~> 10'
19
- end
@@ -1,2 +0,0 @@
1
- require 'sashite/gan'
2
- require 'minitest/autorun'
@@ -1,15 +0,0 @@
1
- require_relative '_test_helper'
2
-
3
- describe Sashite::GAN::Actor do
4
- describe '#to_s' do
5
- before do
6
- @actor = Sashite::GAN::Actor.new 2,
7
- 'bc096c4c7f48fc5c4c162555e4df98169e204aea',
8
- 'top', 'xianqi', 'rook'
9
- end
10
-
11
- it 'returns the GAN of the actor' do
12
- @actor.to_gan.must_equal '2:bc096c4c7f48fc5c4c162555e4df98169e204aea:top:xianqi:rook'
13
- end
14
- end
15
- end