sashite-epin 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +6 -8
- data/lib/sashite/epin.rb +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b308beb3213522cf87199c0b28e1abe7a9d767260ac6ec3ee5f9581ae1ef1bdb
|
4
|
+
data.tar.gz: 3c965f92446dbcf1965844e7454c3bdf1152e2c3e7a74953e974e1239ae6137a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 99a9d2ec0c5834a886517746e7d50206dbb1f331043133df7f1e919a47f506d71a7d5f58798680b3d005640983ab8c22ad7e892b57a0b7df04c8a6401ee28512
|
7
|
+
data.tar.gz: 56d10546fb4068fc8e3ccdaf5f36de9d947b7f7cb2c3cc3a4fd8c9a9c01acfeb7258de0a833a85ddd64d4f889a49e274b045a07d73892e06d774812f0d849729
|
data/README.md
CHANGED
@@ -40,7 +40,6 @@ identifier.state # => :normal
|
|
40
40
|
identifier.native? # => true
|
41
41
|
|
42
42
|
# Create identifiers directly
|
43
|
-
identifier = Sashite::Epin.identifier(:K, :first) # => #<Epin::Identifier type=:K side=:first state=:normal native=true>
|
44
43
|
identifier = Sashite::Epin::Identifier.new(:R, :second, :enhanced, false) # => #<Epin::Identifier type=:R side=:second state=:enhanced native=false>
|
45
44
|
|
46
45
|
# Validate EPIN strings
|
@@ -159,8 +158,8 @@ Where `<pin>` follows the PIN format: `[<state>]<letter>`
|
|
159
158
|
# Native styles: first=Chess, second=Shōgi
|
160
159
|
|
161
160
|
# Native pieces (no derivation suffix)
|
162
|
-
white_king = Sashite::Epin.identifier(:K, :first) # => "K" (Chess king)
|
163
|
-
black_king = Sashite::Epin.identifier(:K, :second) # => "k" (Shōgi king)
|
161
|
+
white_king = Sashite::Epin.identifier(:K, :first, :normal, true) # => "K" (Chess king)
|
162
|
+
black_king = Sashite::Epin.identifier(:K, :second, :normal, true) # => "k" (Shōgi king)
|
164
163
|
|
165
164
|
# Foreign pieces (with derivation suffix)
|
166
165
|
white_shogi_king = Sashite::Epin.identifier(:K, :first, :normal, false) # => "K'" (Shōgi king for white)
|
@@ -215,7 +214,7 @@ foreign_piece.to_s # => "r'" (black foreign rook)
|
|
215
214
|
|
216
215
|
- `Sashite::Epin.valid?(epin_string)` - Check if string is valid EPIN notation
|
217
216
|
- `Sashite::Epin.parse(epin_string)` - Parse EPIN string into Identifier object
|
218
|
-
- `Sashite::Epin.identifier(type, side, state
|
217
|
+
- `Sashite::Epin.identifier(type, side, state, native)` - Create identifier instance directly
|
219
218
|
|
220
219
|
### Identifier Class
|
221
220
|
|
@@ -304,7 +303,7 @@ foreign_chess_king.derived? # => true
|
|
304
303
|
### Immutable Transformations
|
305
304
|
```ruby
|
306
305
|
# All transformations return new instances
|
307
|
-
original = Sashite::Epin.identifier(:K, :first)
|
306
|
+
original = Sashite::Epin.identifier(:K, :first, :normal, true)
|
308
307
|
enhanced = original.enhance
|
309
308
|
derived = original.derive
|
310
309
|
flipped = original.flip
|
@@ -357,8 +356,8 @@ end
|
|
357
356
|
|
358
357
|
# Usage
|
359
358
|
board = CrossStyleGameBoard.new(:chess, :shogi)
|
360
|
-
board.place("e1", Sashite::Epin.identifier(:K, :first))
|
361
|
-
board.place("e8", Sashite::Epin.identifier(:K, :second))
|
359
|
+
board.place("e1", Sashite::Epin.identifier(:K, :first, :normal, true)) # Chess king
|
360
|
+
board.place("e8", Sashite::Epin.identifier(:K, :second, :normal, true)) # Shōgi king
|
362
361
|
board.place("d4", Sashite::Epin.identifier(:Q, :first, :normal, false)) # Chess queen using Shōgi style
|
363
362
|
|
364
363
|
analysis = board.pieces_by_style_derivation
|
@@ -409,7 +408,6 @@ def can_promote_in_style?(piece, target_rank, style_rules)
|
|
409
408
|
end
|
410
409
|
|
411
410
|
# Usage
|
412
|
-
chess_pawn = Sashite::Epin.identifier(:P, :first)
|
413
411
|
shogi_pawn = Sashite::Epin.identifier(:P, :first, :normal, false)
|
414
412
|
|
415
413
|
style_rules = { native: :chess, foreign: :shogi }
|
data/lib/sashite/epin.rb
CHANGED
@@ -20,7 +20,7 @@ module Sashite
|
|
20
20
|
# "+R'" - First player rook (foreign style, enhanced state)
|
21
21
|
# "-p" - Second player pawn (native style, diminished state)
|
22
22
|
#
|
23
|
-
#
|
23
|
+
# @see https://sashite.dev/specs/epin/1.0.0/
|
24
24
|
module Epin
|
25
25
|
# Check if a string is a valid EPIN notation
|
26
26
|
#
|
@@ -62,7 +62,7 @@ module Sashite
|
|
62
62
|
# Sashite::Epin.identifier(:K, :first, :normal, true) # => #<Epin::Identifier type=:K side=:first state=:normal native=true>
|
63
63
|
# Sashite::Epin.identifier(:R, :first, :enhanced, false) # => #<Epin::Identifier type=:R side=:first state=:enhanced native=false>
|
64
64
|
# Sashite::Epin.identifier(:P, :second, :diminished, true) # => #<Epin::Identifier type=:P side=:second state=:diminished native=true>
|
65
|
-
def self.identifier(type, side, state
|
65
|
+
def self.identifier(type, side, state, native)
|
66
66
|
Identifier.new(type, side, state, native)
|
67
67
|
end
|
68
68
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sashite-epin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cyril Kato
|
@@ -15,14 +15,14 @@ dependencies:
|
|
15
15
|
requirements:
|
16
16
|
- - "~>"
|
17
17
|
- !ruby/object:Gem::Version
|
18
|
-
version: 3.
|
18
|
+
version: 3.1.0
|
19
19
|
type: :runtime
|
20
20
|
prerelease: false
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
22
22
|
requirements:
|
23
23
|
- - "~>"
|
24
24
|
- !ruby/object:Gem::Version
|
25
|
-
version: 3.
|
25
|
+
version: 3.1.0
|
26
26
|
description: |
|
27
27
|
EPIN (Extended Piece Identifier Notation) extends PIN to provide style-aware piece representation
|
28
28
|
in abstract strategy board games. This gem implements the EPIN Specification v1.0.0 with
|