sashite-cgsn 0.2.0 → 0.2.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 +5 -5
- data/lib/sashite/cgsn.rb +22 -22
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3013f074440a18a711503672a4ea6e37307692d3c58b64742530e267330e9ca6
|
|
4
|
+
data.tar.gz: 68864b081fbf338eb2bec945295695064f0d19acac1a4ac37ec313f99bb7f09d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 86d1393ca014e448c7ca00193e3faba5968da1599783ea21a88575584a13dbf8669aabdeb44fb5aea45f0b0165e08365141411117320317189152bf984c8c2d1
|
|
7
|
+
data.tar.gz: e0745151074883807146c8114856f3675b75417676821baedf5e7e29d79994c0340e4ffe977243e71ad0c3e17dab1e91c7f2e8814b02c938aa04b5b87556ab44
|
data/README.md
CHANGED
|
@@ -32,9 +32,9 @@ CGSN status values are lowercase strings using underscore separators:
|
|
|
32
32
|
|
|
33
33
|
```ruby
|
|
34
34
|
"checkmate"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
35
|
+
"bareking"
|
|
36
|
+
"timelimit"
|
|
37
|
+
"stale"
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
## API Reference
|
|
@@ -110,11 +110,11 @@ Sashite::Cgsn.valid?("invalid") # => false
|
|
|
110
110
|
|
|
111
111
|
# Check inference capability
|
|
112
112
|
Sashite::Cgsn.inferable?("stalemate") # => true
|
|
113
|
-
Sashite::Cgsn.explicit_only?("
|
|
113
|
+
Sashite::Cgsn.explicit_only?("timelimit") # => true
|
|
114
114
|
|
|
115
115
|
# Get all statuses
|
|
116
116
|
Sashite::Cgsn.statuses
|
|
117
|
-
# => ["
|
|
117
|
+
# => ["stale", "checkmate", "stalemate", ...]
|
|
118
118
|
```
|
|
119
119
|
|
|
120
120
|
## Properties
|
data/lib/sashite/cgsn.rb
CHANGED
|
@@ -13,38 +13,38 @@ module Sashite
|
|
|
13
13
|
module Cgsn
|
|
14
14
|
# Complete list of all defined CGSN status values
|
|
15
15
|
STATUSES = %w[
|
|
16
|
-
|
|
16
|
+
stale
|
|
17
17
|
checkmate
|
|
18
18
|
stalemate
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
nomove
|
|
20
|
+
bareking
|
|
21
|
+
mareking
|
|
22
22
|
insufficient
|
|
23
23
|
resignation
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
illegalmove
|
|
25
|
+
timelimit
|
|
26
|
+
movelimit
|
|
27
27
|
repetition
|
|
28
28
|
agreement
|
|
29
29
|
].freeze
|
|
30
30
|
|
|
31
31
|
# Statuses that can be inferred from position analysis
|
|
32
32
|
INFERABLE_STATUSES = %w[
|
|
33
|
-
|
|
33
|
+
stale
|
|
34
34
|
checkmate
|
|
35
35
|
stalemate
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
nomove
|
|
37
|
+
bareking
|
|
38
|
+
mareking
|
|
39
39
|
insufficient
|
|
40
40
|
].freeze
|
|
41
41
|
|
|
42
42
|
# Statuses that require explicit declaration
|
|
43
43
|
EXPLICIT_ONLY_STATUSES = %w[
|
|
44
44
|
resignation
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
illegalmove
|
|
46
|
+
timelimit
|
|
47
|
+
movelimit
|
|
48
48
|
repetition
|
|
49
49
|
agreement
|
|
50
50
|
].freeze
|
|
@@ -56,8 +56,8 @@ module Sashite
|
|
|
56
56
|
#
|
|
57
57
|
# @example
|
|
58
58
|
# Sashite::Cgsn.valid?("checkmate") # => true
|
|
59
|
-
# Sashite::Cgsn.valid?("
|
|
60
|
-
# Sashite::Cgsn.valid?("
|
|
59
|
+
# Sashite::Cgsn.valid?("nomove") # => true
|
|
60
|
+
# Sashite::Cgsn.valid?("timelimit") # => true
|
|
61
61
|
# Sashite::Cgsn.valid?("invalid") # => false
|
|
62
62
|
# Sashite::Cgsn.valid?("Checkmate") # => false
|
|
63
63
|
# Sashite::Cgsn.valid?(:checkmate) # => true (converts to "checkmate")
|
|
@@ -76,7 +76,7 @@ module Sashite
|
|
|
76
76
|
#
|
|
77
77
|
# @example
|
|
78
78
|
# Sashite::Cgsn.parse("checkmate") # => #<Cgsn::Status value="checkmate">
|
|
79
|
-
# Sashite::Cgsn.parse("
|
|
79
|
+
# Sashite::Cgsn.parse("nomove") # => #<Cgsn::Status value="nomove">
|
|
80
80
|
# Sashite::Cgsn.parse("resignation") # => #<Cgsn::Status value="resignation">
|
|
81
81
|
def self.parse(value)
|
|
82
82
|
Status.new(value)
|
|
@@ -89,7 +89,7 @@ module Sashite
|
|
|
89
89
|
#
|
|
90
90
|
# @example
|
|
91
91
|
# Sashite::Cgsn.inferable?("checkmate") # => true
|
|
92
|
-
# Sashite::Cgsn.inferable?("
|
|
92
|
+
# Sashite::Cgsn.inferable?("nomove") # => true
|
|
93
93
|
# Sashite::Cgsn.inferable?("resignation") # => false
|
|
94
94
|
def self.inferable?(status)
|
|
95
95
|
status_string = String(status)
|
|
@@ -106,7 +106,7 @@ module Sashite
|
|
|
106
106
|
# @example
|
|
107
107
|
# Sashite::Cgsn.explicit_only?("resignation") # => true
|
|
108
108
|
# Sashite::Cgsn.explicit_only?("checkmate") # => false
|
|
109
|
-
# Sashite::Cgsn.explicit_only?("
|
|
109
|
+
# Sashite::Cgsn.explicit_only?("nomove") # => false
|
|
110
110
|
def self.explicit_only?(status)
|
|
111
111
|
status_string = String(status)
|
|
112
112
|
EXPLICIT_ONLY_STATUSES.include?(status_string)
|
|
@@ -120,7 +120,7 @@ module Sashite
|
|
|
120
120
|
#
|
|
121
121
|
# @example
|
|
122
122
|
# Sashite::Cgsn.statuses
|
|
123
|
-
# # => ["
|
|
123
|
+
# # => ["stale", "checkmate", "stalemate", "nomove", ...]
|
|
124
124
|
def self.statuses
|
|
125
125
|
STATUSES.dup
|
|
126
126
|
end
|
|
@@ -131,7 +131,7 @@ module Sashite
|
|
|
131
131
|
#
|
|
132
132
|
# @example
|
|
133
133
|
# Sashite::Cgsn.inferable_statuses
|
|
134
|
-
# # => ["
|
|
134
|
+
# # => ["stale", "checkmate", "stalemate", "nomove", ...]
|
|
135
135
|
def self.inferable_statuses
|
|
136
136
|
INFERABLE_STATUSES.dup
|
|
137
137
|
end
|
|
@@ -142,7 +142,7 @@ module Sashite
|
|
|
142
142
|
#
|
|
143
143
|
# @example
|
|
144
144
|
# Sashite::Cgsn.explicit_only_statuses
|
|
145
|
-
# # => ["resignation", "
|
|
145
|
+
# # => ["resignation", "illegalmove", "timelimit", ...]
|
|
146
146
|
def self.explicit_only_statuses
|
|
147
147
|
EXPLICIT_ONLY_STATUSES.dup
|
|
148
148
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: sashite-cgsn
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Cyril Kato
|
|
@@ -13,9 +13,9 @@ description: |
|
|
|
13
13
|
CGSN (Chess Game Status Notation) provides a rule-agnostic taxonomy of observable game status
|
|
14
14
|
values for abstract strategy board games. This gem implements the CGSN Specification v1.0.0 with
|
|
15
15
|
a minimal Ruby interface featuring immutable status objects and functional programming principles.
|
|
16
|
-
CGSN defines standardized identifiers for terminal conditions (checkmate, stalemate,
|
|
17
|
-
|
|
18
|
-
constraints (
|
|
16
|
+
CGSN defines standardized identifiers for terminal conditions (checkmate, stalemate, bareking,
|
|
17
|
+
mareking, insufficient), player actions (resignation, agreement, illegalmove), and temporal
|
|
18
|
+
constraints (timelimit, movelimit, repetition), enabling precise and portable status identification
|
|
19
19
|
across multiple games and variants. Perfect for game engines, notation systems, and hybrid gaming
|
|
20
20
|
platforms requiring consistent, rule-agnostic game state representation.
|
|
21
21
|
email: contact@cyril.email
|