qi 6.2.0 → 6.3.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 +0 -24
- data/lib/qi/position.rb +0 -21
- metadata +1 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9def332500b0191148a3261cbf17fb9a1a737d46a54366e1f680ee9b924dd2f4
|
4
|
+
data.tar.gz: f9eabe8017a92934537d5a4763a74f0c18a0f3437f4e7a7e417ae18bf420eb8d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 665e3b706f9b8652ff8280652c6ae808b9b968a1ea6e17603bdd27cbb8d43332b6ed532ebf153a192a5cd6049f8a1cbacdaaccd86824054a0583669e2903c127
|
7
|
+
data.tar.gz: e10b2f9376a1d8cd1706b4998f35cb0ef2f9180f9014ccf5193c69e8fbc11d40bfa5a61e9d27c0659c7447c032a884d231f51f92776c01d14a8ef5d6aa782605
|
data/README.md
CHANGED
@@ -62,9 +62,6 @@ starting_position.pieces_in_hand_grouped_by_sides
|
|
62
62
|
starting_position.active_side_id
|
63
63
|
# => 0
|
64
64
|
|
65
|
-
starting_position.feen(9, 9)
|
66
|
-
# => "l,n,s,g,k,g,s,n,l/1,r,5,b,1/p,p,p,p,p,p,p,p,p/9/9/9/P,P,P,P,P,P,P,P,P/1,B,5,R,1/L,N,S,G,K,G,S,N,L 0 /"
|
67
|
-
|
68
65
|
# List of moves (see https://github.com/sashite/pmn.rb)
|
69
66
|
moves = [
|
70
67
|
[ 56, 47, "P" ],
|
@@ -99,9 +96,6 @@ last_position.pieces_in_hand_grouped_by_sides
|
|
99
96
|
|
100
97
|
last_position.active_side_id
|
101
98
|
# => 1
|
102
|
-
|
103
|
-
last_position.feen(9, 9)
|
104
|
-
# => "l,n,s,k,2,s,n,l/1,r,g,1,G,+B,1,b,1/p,p,p,p,p,p,1,p,p/9/9/2,P,6/P,P,1,P,P,P,P,P,P/7,R,1/L,N,S,G,K,G,S,N,L 1 P/"
|
105
99
|
```
|
106
100
|
|
107
101
|
A classic [Tsume Shogi](https://en.wikipedia.org/wiki/Tsume_shogi) problem:
|
@@ -145,9 +139,6 @@ starting_position.pieces_in_hand_grouped_by_sides
|
|
145
139
|
starting_position.active_side_id
|
146
140
|
# => 0
|
147
141
|
|
148
|
-
starting_position.feen(9, 9)
|
149
|
-
# => "3,s,k,s,3/9/4,+P,4/9/7,+B,1/9/9/9/9 0 S/b,g,g,g,g,n,n,n,n,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,r,r,s"
|
150
|
-
|
151
142
|
# List of moves (see https://github.com/sashite/pmn.rb)
|
152
143
|
moves = [
|
153
144
|
[ 43, 13, "+B" ], [ 5, 13, "s", "b" ],
|
@@ -177,9 +168,6 @@ last_position.pieces_in_hand_grouped_by_sides
|
|
177
168
|
|
178
169
|
last_position.active_side_id
|
179
170
|
# => 1
|
180
|
-
|
181
|
-
last_position.feen(9, 9)
|
182
|
-
# => "3,s,k,4/4,s,S,3/4,+P,4/9/9/9/9/9/9 1 /b,b,g,g,g,g,n,n,n,n,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,r,r,s"
|
183
171
|
```
|
184
172
|
|
185
173
|
Another example with [Xiangqi](https://en.wikipedia.org/wiki/Xiangqi)'s Short Double Cannons Checkmate:
|
@@ -221,9 +209,6 @@ starting_position.pieces_in_hand_grouped_by_sides
|
|
221
209
|
starting_position.active_side_id
|
222
210
|
# => 0
|
223
211
|
|
224
|
-
starting_position.feen(10, 9)
|
225
|
-
# => "車,馬,象,士,將,士,象,馬,車/9/1,砲,5,砲,1/卒,1,卒,1,卒,1,卒,1,卒/9/9/兵,1,兵,1,兵,1,兵,1,兵/1,炮,5,炮,1/9/俥,傌,相,仕,帥,仕,相,傌,俥 0 /"
|
226
|
-
|
227
212
|
# List of moves (see https://github.com/sashite/pmn.rb)
|
228
213
|
moves = [
|
229
214
|
[ 64, 67, "炮" ],
|
@@ -259,9 +244,6 @@ last_position.pieces_in_hand_grouped_by_sides
|
|
259
244
|
|
260
245
|
last_position.active_side_id
|
261
246
|
# => 1
|
262
|
-
|
263
|
-
last_position.feen(10, 9)
|
264
|
-
# => "車,馬,象,士,將,士,象,馬,車/9/9/卒,1,卒,1,炮,1,卒,1,卒/9/4,炮,4/兵,砲,兵,1,砲,1,兵,1,兵/9/9/俥,傌,相,仕,帥,仕,相,傌,俥 1 /"
|
265
247
|
```
|
266
248
|
|
267
249
|
Let's do some moves on a [Four-player chess](https://en.wikipedia.org/wiki/Four-player_chess) board:
|
@@ -317,9 +299,6 @@ starting_position.pieces_in_hand_grouped_by_sides
|
|
317
299
|
starting_position.active_side_id
|
318
300
|
# => 0
|
319
301
|
|
320
|
-
starting_position.feen(14, 14)
|
321
|
-
# => "3,yR,yN,yB,yK,yQ,yB,yN,yR,3/3,yP,yP,yP,yP,yP,yP,yP,yP,3/14/bR,bP,10,gP,gR/bN,bP,10,gP,gN/bB,bP,10,gP,gB/bK,bP,10,gP,gQ/bQ,bP,10,gP,gK/bB,bP,10,gP,gB/bN,bP,10,gP,gN/bR,bP,10,gP,gR/14/3,rP,rP,rP,rP,rP,rP,rP,rP,3/3,rR,rN,rB,rQ,rK,rB,rN,rR,3 0 ///"
|
322
|
-
|
323
302
|
# List of moves (see https://github.com/sashite/pmn.rb)
|
324
303
|
moves = [
|
325
304
|
[ 175, 147, "rP" ],
|
@@ -357,9 +336,6 @@ last_position.pieces_in_hand_grouped_by_sides
|
|
357
336
|
|
358
337
|
last_position.active_side_id
|
359
338
|
# => 1
|
360
|
-
|
361
|
-
last_position.feen(14, 14)
|
362
|
-
# => "3,yR,yN,yB,yK,yQ,yB,yN,yR,3/3,yP,yP,yP,1,yP,yP,yP,yP,3/14/bR,bP,4,yP,5,gP,gR/bN,bP,10,gP,gN/bB,bP,10,gP,gB/bK,2,bP,8,gP,gQ/bQ,bP,8,gP,2,gK/bB,bP,10,gP,gB/bN,bP,10,gP,gN/bR,bP,5,rP,4,gP,gR/8,rN,5/3,rP,rP,rP,rP,1,rP,rP,rP,3/3,rR,rN,rB,rQ,rK,rB,1,rR,3 1 ///"
|
363
339
|
```
|
364
340
|
|
365
341
|
## License
|
data/lib/qi/position.rb
CHANGED
@@ -177,26 +177,5 @@ module Qi
|
|
177
177
|
def in_hand_pieces
|
178
178
|
pieces_in_hand_grouped_by_sides.fetch(active_side_id)
|
179
179
|
end
|
180
|
-
|
181
|
-
# Forsyth–Edwards Expanded Notation.
|
182
|
-
#
|
183
|
-
# @see https://developer.sashite.com/specs/forsyth-edwards-expanded-notation
|
184
|
-
#
|
185
|
-
# @param indexes [Array] The shape of the board.
|
186
|
-
#
|
187
|
-
# @example Generate the FEEN string of a Xiangqi position
|
188
|
-
# feen(10, 9)
|
189
|
-
#
|
190
|
-
# @return [String] The FEEN representation of the position.
|
191
|
-
def feen(*indexes)
|
192
|
-
::FEEN.dump(
|
193
|
-
active_side_id: active_side_id,
|
194
|
-
board: squares.each_with_index.inject({}) { |h, (v, i)| v.nil? ? h : h.merge(i.to_s.to_sym => v) },
|
195
|
-
indexes: indexes,
|
196
|
-
pieces_in_hand_grouped_by_sides: pieces_in_hand_grouped_by_sides
|
197
|
-
)
|
198
|
-
end
|
199
180
|
end
|
200
181
|
end
|
201
|
-
|
202
|
-
require "feen"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.
|
4
|
+
version: 6.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cyril Kato
|
@@ -10,20 +10,6 @@ bindir: bin
|
|
10
10
|
cert_chain: []
|
11
11
|
date: 2020-08-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: feen
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: brutal
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|