wtf_chord 0.7.0 → 0.7.1

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: 8d764a30038a11df351e6d3d9dfce09084aa89af352d92b36677ed5eac31e425
4
- data.tar.gz: 0c713ee0f4e3b36720014f56c1c55ca6686981b49e228402d8c2f826463affce
3
+ metadata.gz: d79d3b4f0a6ef8088987819387a46e7e1b4fd4e03614f131dba94ea7cc19e6c8
4
+ data.tar.gz: e7122f195b69586a37c6a570bc0e3b64cf5f4ca8f1e357fc2504be86dfc0d0bc
5
5
  SHA512:
6
- metadata.gz: e83f9de2c3913c4206d7d4f424f46f1082fcd16a50f8f19d4d78f2d83f3a66f610d23852ac66b890190f444db14e74d3fc9249514e6ece64626685c4c7434de2
7
- data.tar.gz: 3ac9226adb773858a51c474c0f1b299e3bf2601ce567d9967c96b297ba4b0895da08c6b50e404221ba636be01d83740fea20b3f5684ebb24a2053b4b81235425
6
+ metadata.gz: d2defd3bdae6c97b0eeb1e899edc1204a53c61a124b6832ac5748c1083fae7714cf322ba53e0000fc36fd217bbd85c0393833fada192cc02df76a2aadd4661b1
7
+ data.tar.gz: 18d8cf19045668207068d5854108292cc045f35da1e9063b7a3d869c78d2d78a98cad034730b8f950c465223128acb30d754a2b84136926a3358484f8575beeb
@@ -37,7 +37,7 @@ module WTFChord
37
37
  end
38
38
 
39
39
  def size
40
- bass? ? -~@notes.size : @notes.size
40
+ bass? ? [*@notes, bass].uniq.size : @notes.size
41
41
  end
42
42
 
43
43
  def original_bass
@@ -16,8 +16,11 @@ module WTFChord
16
16
  notes.each_cons(2).map { |(a, b)| (a.to_i - b.to_i).abs }
17
17
  }
18
18
 
19
- FirstTone = -> (tone, notes) {
20
- Distances[notes]
19
+ Sorting = -> (tone, notes) {
20
+ notes = notes.sort
21
+ mod = (notes[0].note.position - tone.position).abs.next
22
+ score = Distances[notes[1..-1]].sum
23
+ mod + score
21
24
  }.curry(2).freeze
22
25
 
23
26
  def collect!
@@ -28,7 +31,7 @@ module WTFChord
28
31
  combination(size).
29
32
  filter(&FilterProc[size])
30
33
  @fingerings.uniq! { |x| x.map(&:key) }
31
- @fingerings.sort_by!(&FirstTone[tone])
34
+ @fingerings.sort_by!(&Sorting[tone])
32
35
  @fingerings
33
36
  end
34
37
  end
@@ -1,3 +1,3 @@
1
1
  module WTFChord
2
- VERSION = "0.7.0"
2
+ VERSION = "0.7.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wtf_chord
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anton