namero 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4ec3f119c8411016246a15c40422b349db2b79eda32597a34ed3bca564821311
4
- data.tar.gz: f2e5c017ca3b45fa298607d83d5cc70b270bc139cda30ecb540c9f0fc8bf760d
3
+ metadata.gz: e6b43e5791eeddd5fd52e44141a609fc97eb76da497ab686c6add7fb6e6f0f64
4
+ data.tar.gz: 5f5bc91d16f0ad5556f0a69cbb0cb44c81a441f24c76394a184eb88e98aa0f0d
5
5
  SHA512:
6
- metadata.gz: cca575989a770f0383c3fc62e3f95e3f663465b0a776f266110bfbd950f4142eae14dc4060c9d8431145597aeec5f64347f5d5cb19e1825820af9b899b33b914
7
- data.tar.gz: 585ee296abb31a139033b7d4a062b4508d032f9039d376a3f18bb5e1b30613bedfb3b1d564d03190ec17157a962a37c1e23e49e964f75719291f22d57d02ec40
6
+ metadata.gz: 7b18163566d9b80b8855640eca1ef165d6a3cb29e24f453dbda0185da6582eaa65a00727c46616010cfca809c0dfb91df5deb3f602e8e81093dbce04f2673d02
7
+ data.tar.gz: 7faaf576f63e75bb34ab0ce3670454320a5f5b3ba65522fe5bc17f549ffa713506aa284e158dbd4b0e52e7c80235c8a52983afbd1c11f978b595a0fd69c919ab
@@ -17,6 +17,23 @@ module Namero
17
17
  Namero::Board.new(n: n, values: values)
18
18
  end
19
19
 
20
+ # [
21
+ # nil, nil, 4, nil,
22
+ # nil, nil, nil, 1,
23
+ # 4, nil, nil, nil,
24
+ # 2, 1, nil, nil,
25
+ # ]
26
+ def self.load_from_array(array, n)
27
+ values = array.map.with_index do |v, idx|
28
+ if v
29
+ Namero::Value.new(value: v, candidates: [v], index: idx)
30
+ else
31
+ Namero::Value.new(value: nil, candidates: (1..n).to_a, index: idx)
32
+ end
33
+ end
34
+ Namero::Board.new(n: n, values: values)
35
+ end
36
+
20
37
  # n: Integer
21
38
  # values: Array<Integer>
22
39
  def initialize(n:, values: Array.new(n**2))
@@ -1,3 +1,3 @@
1
1
  module Namero
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: namero
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masataka Pocke Kuwabara
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-05-29 00:00:00.000000000 Z
11
+ date: 2020-05-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler