sashite-drop 1.0.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 45e87ee3db030fcceac3b6063ab757fb1ea76196a1c3a80e568ab84cebd4bf1b
4
+ data.tar.gz: ab8764f2ee621be3f56bc7260946d109f9659a478b02ae2a074f6ac1e14c0951
5
+ SHA512:
6
+ metadata.gz: d4e7da427b0e68e13b1ba1069d48c3ae83a12f3e10bb724b34fe78ef8f68819ed4e576cc7348b0a8a6c752e151de4ecb2c812148a1e62d280843008796d6ebb4
7
+ data.tar.gz: a53a2c540df9a9ed9f64d350abe1c1169f1d6a6b94bc575a9f610799ed7f7bf8f9e9f1697e896cfc32f4d2b42d04d72bd770baea561b9cdd15d659ef9205e79e
data/LICENSE.md ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2025 Sashite
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,192 @@
1
+ # Drop.rb
2
+
3
+ [![Version](https://img.shields.io/github/v/tag/sashite/drop.rb?label=Version&logo=github)](https://github.com/sashite/drop.rb/tags)
4
+ [![Yard documentation](https://img.shields.io/badge/Yard-documentation-blue.svg?logo=github)](https://rubydoc.info/github/sashite/drop.rb/main)
5
+ ![Ruby](https://github.com/sashite/drop.rb/actions/workflows/main.yml/badge.svg?branch=main)
6
+ [![License](https://img.shields.io/github/license/sashite/drop.rb?label=License&logo=github)](https://github.com/sashite/drop.rb/raw/main/LICENSE.md)
7
+
8
+ > **DROP** (Droppable Reserve Operations Placement) support for the Ruby language.
9
+
10
+ ## What is DROP?
11
+
12
+ DROP (Droppable Reserve Operations Placement) is a simple, standardized notation for representing piece reserve locations in board games where captured pieces can be held and/or placed onto the board. This applies to games like shōgi, crazyhouse, go, and other games featuring capture-and-drop mechanics.
13
+
14
+ This gem implements the [DROP Specification v1.0.0](https://sashite.dev/documents/drop/1.0.0/), providing a Ruby interface for working with reserve locations through a functional and minimalist API.
15
+
16
+ ## Installation
17
+
18
+ ```ruby
19
+ # In your Gemfile
20
+ gem "sashite-drop"
21
+ ```
22
+
23
+ Or install manually:
24
+
25
+ ```sh
26
+ gem install sashite-drop
27
+ ```
28
+
29
+ ## DROP Format
30
+
31
+ DROP uses a single character to represent all off-board reserve locations:
32
+
33
+ **Reserve Location**: `*` (asterisk)
34
+ - **Unicode**: U+002A
35
+ - **ASCII**: 42
36
+ - **UTF-8**: 0x2A
37
+
38
+ ## Basic Usage
39
+
40
+ ### Basic Usage
41
+
42
+ The primary functionality is checking if a location represents the reserve:
43
+
44
+ ```ruby
45
+ require "sashite/drop"
46
+
47
+ # Check if a string represents the reserve location
48
+ Sashite::Drop.reserve?("*") # => true
49
+ Sashite::Drop.reserve?("a1") # => false
50
+ Sashite::Drop.reserve?("**") # => false
51
+ Sashite::Drop.reserve?("") # => false
52
+
53
+ # Alias for convenience
54
+ Drop = Sashite::Drop
55
+ Drop.reserve?("*") # => true
56
+ ```
57
+
58
+ ### String Representation
59
+
60
+ ```ruby
61
+ # Get the canonical DROP representation
62
+ Sashite::Drop.to_s # => "*"
63
+ ```
64
+
65
+ ## Usage Examples
66
+
67
+ ### Movement Notation
68
+
69
+ ```ruby
70
+ # Representing moves with DROP notation
71
+ source = "*" # From reserve
72
+ destination = "e4" # To board position (using CELL coordinates)
73
+
74
+ # Check if move involves reserve
75
+ Sashite::Drop.reserve?(source) # => true (drop move)
76
+ Sashite::Drop.reserve?(destination) # => false (board position)
77
+ ```
78
+
79
+ ### Game Context Examples
80
+
81
+ **Shōgi**
82
+
83
+ ```ruby
84
+ # Reserve operations
85
+ reserve = "*"
86
+ board_position = "5e"
87
+
88
+ # Drop move: place piece from reserve to board
89
+ puts "Dropping piece from reserve to #{board_position}" if Sashite::Drop.reserve?(reserve)
90
+ ```
91
+
92
+ **Crazyhouse**
93
+
94
+ ```ruby
95
+ # Capture to reserve
96
+ captured_position = "e4"
97
+ reserve = "*"
98
+
99
+ # Capture move: piece goes to reserve
100
+ puts "Piece captured to reserve from #{captured_position}" if Sashite::Drop.reserve?(reserve)
101
+ ```
102
+
103
+ ## Integration with CELL
104
+
105
+ DROP complements the CELL specification for complete location coverage:
106
+
107
+ ```ruby
108
+ # Combined location validation
109
+ def valid_location?(location)
110
+ Sashite::Drop.reserve?(location) || Cell.valid?(location)
111
+ end
112
+
113
+ valid_location?("*") # => true (reserve)
114
+ valid_location?("a1") # => true (board position)
115
+ valid_location?("xx") # => false (invalid)
116
+ ```
117
+
118
+ ## API Reference
119
+
120
+ ### Module Methods
121
+
122
+ - `Sashite::Drop.reserve?(string)` - Check if string represents the reserve location
123
+ - `Sashite::Drop.to_s` - Get the canonical DROP representation (`"*"`)
124
+
125
+ ### Constants
126
+
127
+ - `Sashite::Drop::RESERVE` - The reserve location character (`"*"`)
128
+
129
+ ## Properties of DROP
130
+
131
+ * **Minimalist**: Uses only a single character (`*`) for all reserve operations
132
+ * **Universal**: Works across different board game types and rule systems
133
+ * **Complementary**: Designed to work alongside CELL coordinates for complete game notation
134
+ * **Functional**: Provides a clean, stateless API for reserve location operations
135
+
136
+ ## Constraints
137
+
138
+ * DROP represents **only off-board reserve locations**
139
+ * The asterisk (`*`) is the **only valid DROP character**
140
+ * Context determines the specific meaning (player's reserve, captured pieces, stone supply, etc.)
141
+ * For on-board positions, use **CELL coordinates** instead
142
+
143
+ ## Examples in Different Games
144
+
145
+ ### Shogi
146
+
147
+ ```ruby
148
+ # Piece in hand (reserve)
149
+ reserve = "*"
150
+ Sashite::Drop.reserve?(reserve) # => true
151
+
152
+ # Drop to board
153
+ destination = "5e"
154
+ puts "#{reserve} → #{destination}" # "* → 5e"
155
+ ```
156
+
157
+ ### Go
158
+
159
+ ```ruby
160
+ # Stone supply (reserve)
161
+ supply = "*"
162
+ Sashite::Drop.reserve?(supply) # => true
163
+
164
+ # Place stone
165
+ position = "dd"
166
+ puts "#{supply} → #{position}" # "* → dd"
167
+ ```
168
+
169
+ ### Crazyhouse
170
+
171
+ ```ruby
172
+ # Captured piece reserve
173
+ reserve = "*"
174
+ Sashite::Drop.reserve?(reserve) # => true
175
+
176
+ # Drop piece
177
+ square = "e4"
178
+ puts "#{reserve} → #{square}" # "* → e4"
179
+ ```
180
+
181
+ ## Documentation
182
+
183
+ - [Official DROP Specification](https://sashite.dev/documents/drop/1.0.0/)
184
+ - [API Documentation](https://rubydoc.info/github/sashite/drop.rb/main)
185
+
186
+ ## License
187
+
188
+ The [gem](https://rubygems.org/gems/sashite-drop) is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
189
+
190
+ ## About Sashité
191
+
192
+ This project is maintained by [Sashité](https://sashite.com/) — promoting chess variants and sharing the beauty of Chinese, Japanese, and Western chess cultures.
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Sashite
4
+ # DROP (Droppable Reserve Operations Placement) implementation
5
+ #
6
+ # DROP defines a simple, standardized notation for piece reserve locations
7
+ # in board games where captured pieces can be held and/or placed onto the board.
8
+ #
9
+ # @see https://sashite.dev/documents/drop/1.0.0/
10
+ # @author Sashité
11
+ # @since 1.0.0
12
+ #
13
+ # @example Basic usage
14
+ # Sashite::Drop.reserve?("*") # => true
15
+ # Sashite::Drop.reserve?("a1") # => false
16
+ # Sashite::Drop.to_s # => "*"
17
+ module Drop
18
+ # The reserve location character
19
+ RESERVE = "*"
20
+
21
+ # Check if a string represents the reserve location
22
+ #
23
+ # @param string [String] the string to check
24
+ # @return [Boolean] true if the string is the reserve location
25
+ #
26
+ # @example
27
+ # Sashite::Drop.reserve?("*") # => true
28
+ # Sashite::Drop.reserve?("a1") # => false
29
+ # Sashite::Drop.reserve?("**") # => false
30
+ # Sashite::Drop.reserve?("") # => false
31
+ def self.reserve?(string)
32
+ RESERVE.eql?(string)
33
+ end
34
+
35
+ # Get the canonical DROP representation
36
+ #
37
+ # @return [String] the reserve location character
38
+ #
39
+ # @example
40
+ # Sashite::Drop.to_s # => "*"
41
+ def self.to_s
42
+ RESERVE
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Sashité namespace
4
+ module Sashite
5
+ # @see https://sashite.dev/documents/drop/1.0.0/ DROP Specification v1.0.0
6
+ # @author Sashité
7
+ # @since 1.0.0
8
+ end
9
+
10
+ require_relative "sashite/drop"
metadata ADDED
@@ -0,0 +1,52 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sashite-drop
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Cyril Kato
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies: []
12
+ description: DROP defines a simple, standardized notation for piece reserve locations
13
+ in board games where captured pieces can be held and/or placed onto the board. This
14
+ applies to games like shōgi, crazyhouse, go, and other games featuring capture-and-drop
15
+ mechanics.
16
+ email: contact@cyril.email
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - LICENSE.md
22
+ - README.md
23
+ - lib/sashite-drop.rb
24
+ - lib/sashite/drop.rb
25
+ homepage: https://github.com/sashite/drop.rb
26
+ licenses:
27
+ - MIT
28
+ metadata:
29
+ bug_tracker_uri: https://github.com/sashite/drop.rb/issues
30
+ documentation_uri: https://rubydoc.info/github/sashite/drop.rb/main
31
+ homepage_uri: https://github.com/sashite/drop.rb
32
+ source_code_uri: https://github.com/sashite/drop.rb
33
+ specification_uri: https://sashite.dev/documents/drop/1.0.0/
34
+ rubygems_mfa_required: 'true'
35
+ rdoc_options: []
36
+ require_paths:
37
+ - lib
38
+ required_ruby_version: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 3.2.0
43
+ required_rubygems_version: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ requirements: []
49
+ rubygems_version: 3.6.7
50
+ specification_version: 4
51
+ summary: DROP (Droppable Reserve Operations Placement) implementation for Ruby
52
+ test_files: []