solver_24 0.3.0 → 0.4.0

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
  SHA1:
3
- metadata.gz: 1367e899d971aea07bbb8c01f8d00f8a5945364d
4
- data.tar.gz: 96464ff3244bd29eba328cff2a6d186e7a071689
3
+ metadata.gz: 718be75fa6a180ebf52c990da5c9697e2447dd98
4
+ data.tar.gz: 8de9f8c47ffe4bd2bcd4d13bdaaa4663d3b21228
5
5
  SHA512:
6
- metadata.gz: e0e52a950edc40b97e5c1064b5dd2623cc8e7dfbe885f519f88f66ce73a08cf64727dc35bc32d79f61a65ef108b42682fc2bb158982cc35e614b9725c9d097f7
7
- data.tar.gz: c19828fe4494b74d0dbecc2ea93ed3834f4cc129394011e7143d1a5b721df0c9ff21e41cda073800745cccadde17bf1a2271a28874ca779d3fe7b0983f004256
6
+ metadata.gz: 344f3fdebeafdfbb2f700e0b98fab08e6a07f7502c779c8438fc1dd8b8e4880c9ff6e884a94c7f4bb1102488ec4fa3f380e4949ac2ba914cd4d753b6813d718a
7
+ data.tar.gz: 011619cf7830d55cf620e3236fe89fbd8f5f8a8b4376893fcc890dd9d9f54c09609fc5411dd696365028d514ac5ca078ebd204c53aec30bda09469970d4e528a
data/README.md CHANGED
@@ -19,14 +19,10 @@ Or install it yourself as:
19
19
 
20
20
  ## Usage
21
21
 
22
- To show one solution eg: ( 1.0 + 2.0 + 3.0 ) * 4.0 = 24
22
+ This returns an array of solutions eg: ["( 1.0 + 2.0 + 3.0 ) * 4.0", "( 1.0 * 2.0 ) * 3.0 * 4.0"...]
23
23
 
24
24
  `Solver_24.new.solve([1,2,3,4])`
25
25
 
26
- To return an array of solutions eg: ["( 1.0 + 2.0 + 3.0 ) * 4.0", "( 1.0 * 2.0 ) * 3.0 * 4.0"...]
27
-
28
- `Solver_24.new.show_all_solutions`
29
-
30
26
  ## Development
31
27
 
32
28
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -1,3 +1,3 @@
1
1
  module Solver24
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
data/lib/solver_24.rb CHANGED
@@ -12,18 +12,10 @@ class Solver_24
12
12
 
13
13
  def solve(a)
14
14
  make_possible_solutions(get_sets_of_numbers(a))
15
-
16
15
  find_solutions
17
-
18
- puts "#{solutions.first} = 24"
16
+ solutions
19
17
  end
20
18
 
21
- def show_all_solutions(a)
22
- make_possible_solutions(get_sets_of_numbers(a))
23
- find_solutions
24
- p solutions
25
- end
26
-
27
19
  def get_sets_of_numbers(a)
28
20
  a.permutation(4).to_a.tap do |numbers|
29
21
  numbers.each { |set| set.map!(&:to_f)}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solver_24
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ka Mok