sashite-cgsn 0.1.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 +29 -19
- metadata +5 -5
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,36 +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
|
-
|
|
19
|
+
nomove
|
|
20
|
+
bareking
|
|
21
|
+
mareking
|
|
21
22
|
insufficient
|
|
22
23
|
resignation
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
illegalmove
|
|
25
|
+
timelimit
|
|
26
|
+
movelimit
|
|
26
27
|
repetition
|
|
27
28
|
agreement
|
|
28
29
|
].freeze
|
|
29
30
|
|
|
30
31
|
# Statuses that can be inferred from position analysis
|
|
31
32
|
INFERABLE_STATUSES = %w[
|
|
32
|
-
|
|
33
|
+
stale
|
|
33
34
|
checkmate
|
|
34
35
|
stalemate
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
nomove
|
|
37
|
+
bareking
|
|
38
|
+
mareking
|
|
37
39
|
insufficient
|
|
38
40
|
].freeze
|
|
39
41
|
|
|
40
42
|
# Statuses that require explicit declaration
|
|
41
43
|
EXPLICIT_ONLY_STATUSES = %w[
|
|
42
44
|
resignation
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
illegalmove
|
|
46
|
+
timelimit
|
|
47
|
+
movelimit
|
|
46
48
|
repetition
|
|
47
49
|
agreement
|
|
48
50
|
].freeze
|
|
@@ -54,11 +56,14 @@ module Sashite
|
|
|
54
56
|
#
|
|
55
57
|
# @example
|
|
56
58
|
# Sashite::Cgsn.valid?("checkmate") # => true
|
|
57
|
-
# Sashite::Cgsn.valid?("
|
|
59
|
+
# Sashite::Cgsn.valid?("nomove") # => true
|
|
60
|
+
# Sashite::Cgsn.valid?("timelimit") # => true
|
|
58
61
|
# Sashite::Cgsn.valid?("invalid") # => false
|
|
59
62
|
# Sashite::Cgsn.valid?("Checkmate") # => false
|
|
63
|
+
# Sashite::Cgsn.valid?(:checkmate) # => true (converts to "checkmate")
|
|
60
64
|
def self.valid?(value)
|
|
61
|
-
|
|
65
|
+
status_string = String(value)
|
|
66
|
+
STATUSES.include?(status_string)
|
|
62
67
|
rescue ::TypeError
|
|
63
68
|
false
|
|
64
69
|
end
|
|
@@ -71,6 +76,7 @@ module Sashite
|
|
|
71
76
|
#
|
|
72
77
|
# @example
|
|
73
78
|
# Sashite::Cgsn.parse("checkmate") # => #<Cgsn::Status value="checkmate">
|
|
79
|
+
# Sashite::Cgsn.parse("nomove") # => #<Cgsn::Status value="nomove">
|
|
74
80
|
# Sashite::Cgsn.parse("resignation") # => #<Cgsn::Status value="resignation">
|
|
75
81
|
def self.parse(value)
|
|
76
82
|
Status.new(value)
|
|
@@ -83,9 +89,11 @@ module Sashite
|
|
|
83
89
|
#
|
|
84
90
|
# @example
|
|
85
91
|
# Sashite::Cgsn.inferable?("checkmate") # => true
|
|
92
|
+
# Sashite::Cgsn.inferable?("nomove") # => true
|
|
86
93
|
# Sashite::Cgsn.inferable?("resignation") # => false
|
|
87
94
|
def self.inferable?(status)
|
|
88
|
-
|
|
95
|
+
status_string = String(status)
|
|
96
|
+
INFERABLE_STATUSES.include?(status_string)
|
|
89
97
|
rescue ::TypeError
|
|
90
98
|
false
|
|
91
99
|
end
|
|
@@ -98,8 +106,10 @@ module Sashite
|
|
|
98
106
|
# @example
|
|
99
107
|
# Sashite::Cgsn.explicit_only?("resignation") # => true
|
|
100
108
|
# Sashite::Cgsn.explicit_only?("checkmate") # => false
|
|
109
|
+
# Sashite::Cgsn.explicit_only?("nomove") # => false
|
|
101
110
|
def self.explicit_only?(status)
|
|
102
|
-
|
|
111
|
+
status_string = String(status)
|
|
112
|
+
EXPLICIT_ONLY_STATUSES.include?(status_string)
|
|
103
113
|
rescue ::TypeError
|
|
104
114
|
false
|
|
105
115
|
end
|
|
@@ -110,7 +120,7 @@ module Sashite
|
|
|
110
120
|
#
|
|
111
121
|
# @example
|
|
112
122
|
# Sashite::Cgsn.statuses
|
|
113
|
-
# # => ["
|
|
123
|
+
# # => ["stale", "checkmate", "stalemate", "nomove", ...]
|
|
114
124
|
def self.statuses
|
|
115
125
|
STATUSES.dup
|
|
116
126
|
end
|
|
@@ -121,7 +131,7 @@ module Sashite
|
|
|
121
131
|
#
|
|
122
132
|
# @example
|
|
123
133
|
# Sashite::Cgsn.inferable_statuses
|
|
124
|
-
# # => ["
|
|
134
|
+
# # => ["stale", "checkmate", "stalemate", "nomove", ...]
|
|
125
135
|
def self.inferable_statuses
|
|
126
136
|
INFERABLE_STATUSES.dup
|
|
127
137
|
end
|
|
@@ -132,7 +142,7 @@ module Sashite
|
|
|
132
142
|
#
|
|
133
143
|
# @example
|
|
134
144
|
# Sashite::Cgsn.explicit_only_statuses
|
|
135
|
-
# # => ["resignation", "
|
|
145
|
+
# # => ["resignation", "illegalmove", "timelimit", ...]
|
|
136
146
|
def self.explicit_only_statuses
|
|
137
147
|
EXPLICIT_ONLY_STATUSES.dup
|
|
138
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.1
|
|
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
|
|
@@ -53,7 +53,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
54
|
version: '0'
|
|
55
55
|
requirements: []
|
|
56
|
-
rubygems_version: 3.7.
|
|
56
|
+
rubygems_version: 3.7.2
|
|
57
57
|
specification_version: 4
|
|
58
58
|
summary: CGSN (Chess Game Status Notation) implementation for Ruby with immutable
|
|
59
59
|
status objects
|