sashite-ggn 0.9.0 → 0.9.1
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 +2 -0
- data/lib/sashite/ggn.rb +15 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e471fdf36ded96b18559ff0c7f6ba47b9210624d019452bc4037b93e484cf29c
|
|
4
|
+
data.tar.gz: cd99ab6b95f0bdc4377c87c67864c861288d0d7dec536450cf36698c6da5b3de
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ce76a683d986574ff72d6830805aa90f636e617349f04514feca2a500b2510d073f59f305a9c666100848a1b5e5806b9d59b97f5bb1aae870eff2fd982f4755e
|
|
7
|
+
data.tar.gz: 98cc6ac792be2873d3a73fb9154ec0493614f82bcb2d10087224246fbb1d8206b21335f0ab1d175509a815210a4ec22deb8e0103eb5c1c83ad1cfe6f6c65f2ea
|
data/README.md
CHANGED
|
@@ -346,6 +346,8 @@ transitions = engine.where(active_side, squares)
|
|
|
346
346
|
| **deny** | Hash (LCN) | Pre-conditions that must not be satisfied |
|
|
347
347
|
| **diff** | Hash (STN) | State transition specification |
|
|
348
348
|
|
|
349
|
+
**Note (normative)**: To preserve GGN's board-reachability scope, entries where **`source="*"` and `destination="*"`** (direct **HAND→HAND**) are **forbidden** by the specification.
|
|
350
|
+
|
|
349
351
|
---
|
|
350
352
|
|
|
351
353
|
## Usage Examples
|
data/lib/sashite/ggn.rb
CHANGED
|
@@ -118,11 +118,26 @@ module Sashite
|
|
|
118
118
|
|
|
119
119
|
destinations.each do |destination, possibilities|
|
|
120
120
|
validate_location!(destination, piece)
|
|
121
|
+
validate_hand_to_hand!(source, destination)
|
|
121
122
|
validate_possibilities!(possibilities, piece, source, destination)
|
|
122
123
|
end
|
|
123
124
|
end
|
|
124
125
|
private_class_method :validate_destinations!
|
|
125
126
|
|
|
127
|
+
# Validate that source and destination are not both HAND ("*")
|
|
128
|
+
#
|
|
129
|
+
# @param source [String] Source location
|
|
130
|
+
# @param destination [String] Destination location
|
|
131
|
+
# @raise [ArgumentError] If both source and destination are HAND
|
|
132
|
+
# @return [void]
|
|
133
|
+
# @api private
|
|
134
|
+
def self.validate_hand_to_hand!(source, destination)
|
|
135
|
+
return unless Hand.reserve?(source) && Hand.reserve?(destination)
|
|
136
|
+
|
|
137
|
+
raise ::ArgumentError, "Invalid HAND→HAND movement: source and destination cannot both be '*' (forbidden by GGN specification)"
|
|
138
|
+
end
|
|
139
|
+
private_class_method :validate_hand_to_hand!
|
|
140
|
+
|
|
126
141
|
# Validate possibilities array structure
|
|
127
142
|
#
|
|
128
143
|
# @param possibilities [Array] Possibilities array to validate
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: sashite-ggn
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.9.
|
|
4
|
+
version: 0.9.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Cyril Kato
|
|
@@ -122,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
122
122
|
- !ruby/object:Gem::Version
|
|
123
123
|
version: '0'
|
|
124
124
|
requirements: []
|
|
125
|
-
rubygems_version: 3.
|
|
125
|
+
rubygems_version: 3.7.1
|
|
126
126
|
specification_version: 4
|
|
127
127
|
summary: General Gameplay Notation (GGN) - movement possibilities for board games
|
|
128
128
|
test_files: []
|