qi 10.0.0.beta2 → 10.0.0.beta3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/qi/action.rb +8 -21
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed62693adaee42b6e7a64ea4e3475154b3ba8cf1af7a68d0ec33835183ec7270
|
4
|
+
data.tar.gz: 2d1fde31acc76b566da0ad07126debb554b26623417ed5b450da6310765bff15
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50722f79e25fa9012be5c44a93b6bc4667b03caae75de426fe84ab62b007a241bf9c956c7ce03843348f673a273d7a543dae05af2479b4f66ef0e929e6f8cfd2
|
7
|
+
data.tar.gz: 9f11b1e6ef5fe6a901bea7242f94d7640789c114ec6173e6047e15b48d67a38fad18e3bc0fda3962cd9b148558d65142abb563225802e4f3fb788a025d4826d1
|
data/README.md
CHANGED
data/lib/qi/action.rb
CHANGED
@@ -16,33 +16,20 @@ module Qi
|
|
16
16
|
#
|
17
17
|
# @return [Array] An action to change the position.
|
18
18
|
def call(**diffs)
|
19
|
-
|
20
|
-
|
19
|
+
capture = diffs.delete(CAPTURE_CHAR)
|
20
|
+
drop = diffs.delete(DROP_CHAR)
|
21
21
|
|
22
|
-
|
23
|
-
case String(k)
|
24
|
-
when CAPTURE_CHAR
|
25
|
-
captures = capture(v, *captures)
|
26
|
-
when DROP_CHAR
|
27
|
-
captures = drop(v, *captures)
|
28
|
-
else
|
29
|
-
squares = squares.merge(k => v)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
[captures, squares.compact]
|
22
|
+
change(*@captures, capture:, drop:, **diffs)
|
34
23
|
end
|
35
24
|
|
36
25
|
private
|
37
26
|
|
38
|
-
def
|
39
|
-
|
40
|
-
|
27
|
+
def change(*captures, capture: nil, drop: nil, **squares)
|
28
|
+
captures.unshift(capture) unless capture.nil?
|
29
|
+
captures.delete(drop) { |key| raise ::IndexError, "Capture #{key.inspect} not found!" } unless drop.nil?
|
30
|
+
squares = @squares.merge(squares).compact
|
41
31
|
|
42
|
-
|
43
|
-
item_id = items.index(item) || raise(::IndexError, "Piece #{item.inspect} not found!")
|
44
|
-
items.delete_at(item_id)
|
45
|
-
items
|
32
|
+
[captures, squares]
|
46
33
|
end
|
47
34
|
end
|
48
35
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 10.0.0.
|
4
|
+
version: 10.0.0.beta3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cyril Kato
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-04-21 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: An abstraction that could help to update positions for games like Shogi.
|
14
14
|
email: contact@cyril.email
|
@@ -41,7 +41,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: 1.3.1
|
43
43
|
requirements: []
|
44
|
-
rubygems_version: 3.4.
|
44
|
+
rubygems_version: 3.4.6
|
45
45
|
signing_key:
|
46
46
|
specification_version: 4
|
47
47
|
summary: An abstraction that could help to update positions for games like Shogi.
|