namero 0.0.2 → 0.0.3

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: a16aa7fdc8f9a4b1eb651be7507bb91b42abb79e339f5ce0a2fa56481b8d83c4
4
- data.tar.gz: c44cf9c0c379494ec46ebc4458ebce94590731eeee179051176c70db3cbbeb49
3
+ metadata.gz: d873a422ed56c6cd9838805394b1c2fb1ae7ad33f6eb65fb2338880f598fb427
4
+ data.tar.gz: b71ec4d6319f4267142997c99a3f4ac85d987ef9e5526d837b31544c93eee75d
5
5
  SHA512:
6
- metadata.gz: 79fdeed7e19beb90ed5d14167e755a4115209e4f9e0b936d2b975c637a1820e80d99526b05dc851433083d6cc99bf7b4accf0c1b3548872206559144f449b5e2
7
- data.tar.gz: d1cbba7f9774777b7ddbf1113eaa0cb1925b7769bf9ef65ecd9e392b621b6551b2eb2e212c392837fb5bf9641a2c0c6166c49b81f7ee934bf23d0339db296664
6
+ metadata.gz: 71ee42cdf9509fd8daf2699a37f9979ee83ae4f70dbeaaed762f0c2eb1ee740bd8a901fe49699579183712e9485a7580205b3334823154d0e72dd896aad669e0
7
+ data.tar.gz: 840f26d770194bb6d32e2243fe61f18d39bccd537fe1cc144e1935ac2ba804ca78d887b62e1c31c2603f45f01b2cbd199e5b9eaeb00fe00758a6ffe96ecd2ad6
@@ -69,7 +69,7 @@ module Namero
69
69
  @values[start...start+@n]
70
70
  when :column
71
71
  x = idx % n
72
- @values.each_slice(n).map{|row| row[x]}
72
+ Array.new(n) { |i| @values[i * n + x] }
73
73
  when :block
74
74
  x = idx % n
75
75
  y = idx / n
@@ -11,7 +11,7 @@ module Namero
11
11
  def solve
12
12
  fill_candidates
13
13
  loop do
14
- idx = updated_candidate_queue.each.first
14
+ idx = updated_candidate_queue.first
15
15
  unless idx
16
16
  extensions.each do |ex|
17
17
  ex.solve(board, updated_candidate_queue)
@@ -38,19 +38,19 @@ module Namero
38
38
  def fill_candidate_for(v)
39
39
  board[v.index, :row].each do |v2|
40
40
  unless v2.value
41
- v2.candidates -= [v.value]
41
+ v2.candidates.delete(v.value)
42
42
  updated_candidate_queue << v2.index
43
43
  end
44
44
  end
45
45
  board[v.index, :column].each do |v2|
46
46
  unless v2.value
47
- v2.candidates -= [v.value]
47
+ v2.candidates.delete(v.value)
48
48
  updated_candidate_queue << v2.index
49
49
  end
50
50
  end
51
51
  board[v.index, :block].each do |v2|
52
52
  unless v2.value
53
- v2.candidates -= [v.value]
53
+ v2.candidates.delete(v.value)
54
54
  updated_candidate_queue << v2.index
55
55
  end
56
56
  end
@@ -20,7 +20,7 @@ module Namero
20
20
  (1..n).each do |v|
21
21
  box = nil
22
22
  group.each do |value|
23
- if value.candidates.include?(v) && value.value.nil?
23
+ if !value.value && value.candidates.include?(v)
24
24
  if box
25
25
  box = nil
26
26
  break
@@ -1,3 +1,3 @@
1
1
  module Namero
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
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.2
4
+ version: 0.0.3
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: 2019-07-14 00:00:00.000000000 Z
11
+ date: 2020-05-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -90,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
90
90
  - !ruby/object:Gem::Version
91
91
  version: '0'
92
92
  requirements: []
93
- rubygems_version: 3.0.3
93
+ rubygems_version: 3.2.0.pre1
94
94
  signing_key:
95
95
  specification_version: 4
96
96
  summary: ''