rypto 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 73ab84dfc3fcc054fd8ef7a809e50f74a43e1010
4
+ data.tar.gz: 0d3b8997e7d6439faac3cc6154a92130ca0caafd
5
+ SHA512:
6
+ metadata.gz: 3dd48356a1d13ac6067b59244b0b8f66f6397a4fe05510b6818fc5c86877c3186b60b1c15938f8924c1b0dd1197700f3a8b3d310f70b5232c446d45df6eeb185
7
+ data.tar.gz: 2e407aad9f741690abf0430ac8a5e68e4193e0615ef19044d684002e665f5621a4d4f8e095d1e7d436801b5d79ec2b4b0301688df9ee64c67918e868f2087b48
data/.gitignore ADDED
@@ -0,0 +1,15 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
15
+ example/Gemfile.lock
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ rypto
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ ruby-2.2.1
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ ---
2
+ language: ruby
3
+ script: COVERAGE=true bundle exec rake build
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in rypto.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Joe Sortelli
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,102 @@
1
+ # Rypto
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/rypto.svg)](http://badge.fury.io/rb/rypto)
4
+ [![Build Status](https://travis-ci.org/sortelli/rypto.svg?branch=develop)](https://travis-ci.org/sortelli/rypto)
5
+ [![Dependency Status](https://gemnasium.com/sortelli/rypto.svg)](https://gemnasium.com/sortelli/rypto)
6
+
7
+
8
+ A ruby gem library that provides an API for solving hands from the
9
+ Krypto card game. Read more about
10
+ [Krypto](http://en.wikipedia.org/wiki/Krypto_%28game%29).
11
+
12
+ ## Installation
13
+
14
+ Add this line to your application's Gemfile:
15
+
16
+ ```ruby
17
+ gem 'rypto'
18
+ ```
19
+
20
+ And then execute:
21
+
22
+ ```bash
23
+ % bundle install
24
+ ```
25
+
26
+ Or install it yourself as:
27
+
28
+ ```bash
29
+ % gem install rypto
30
+ ```
31
+
32
+ ## Examples
33
+
34
+ ### Deal a hand of Krypto
35
+
36
+ This example shows creating a deck, dealing a hand of Krypto, and
37
+ inspecting the possible solutions to the hand.
38
+
39
+ ```ruby
40
+ require 'rypto'
41
+
42
+ deck = Rypto::Deck.new
43
+
44
+ #Deal a random hand from the deck (removes dealt cards from deck)
45
+ hand = deck.deal_hand
46
+
47
+ #Print results in infix notation
48
+ puts hand.solve.infix
49
+ ```
50
+
51
+ This will output:
52
+
53
+ ```
54
+ (19 + 4 - 23) * 14 + 8 = 8
55
+ (19 + 4 - 23) / 14 + 8 = 8
56
+ (19 - 23 - 4) * 14 + 8 = 8
57
+ (19 - 23 - 4) / 14 + 8 = 8
58
+ (19 - 23 - 14 + 8) * 4 = 8
59
+ (19 - 23 - 14 - 8) * 4 = 8
60
+ (19 - 23 - 14 - 8) * 4 = 8
61
+ 19 - 23 - 14 - 8 / 4 = 8
62
+ 19 - 23 - 14 + 8 / 4 = 8
63
+ 19 - 23 - 14 - 8 / 4 = 8
64
+ ...results truncated...
65
+ ```
66
+
67
+ ### Solve a specific hand of Krypto
68
+
69
+ One can create a hand manually to solve a specific Krypto deal.
70
+
71
+ ```ruby
72
+ hand = Rypto::Hand.new [1,2,3,4,5], 6
73
+
74
+ #Print results in postfix notation
75
+ puts hand.solve.postfix
76
+ ```
77
+
78
+ This will output:
79
+
80
+ ```
81
+ 1 2 + 3 4 + 5 - * = 6
82
+ 1 2 3 + 4 - 5 + * = 6
83
+ 1 2 3 + 4 - * 5 + = 6
84
+ 1 2 3 + 4 - 5 * + = 6
85
+ 1 2 3 + 4 - / 5 + = 6
86
+ 1 2 3 + * 4 - 5 + = 6
87
+ 1 2 3 * 4 + + 5 - = 6
88
+ 1 2 3 * + 4 + 5 - = 6
89
+ 1 2 * 3 + 4 - 5 + = 6
90
+ 1 2 3 * 4 + 5 - + = 6
91
+ ...results truncated...
92
+ ```
93
+
94
+ ## Documentation
95
+
96
+ [API Documentation](http://www.rubydoc.info/gems/rypto/0.1.0)
97
+
98
+ ## License
99
+
100
+ Copyright (c) 2015 Joe Sortelli
101
+
102
+ MIT License
data/Rakefile ADDED
@@ -0,0 +1,13 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new do |t|
5
+ t.test_files = FileList['test/*.rb'].exclude('test/test_helper.rb')
6
+ end
7
+
8
+ task :build => :test
9
+
10
+ task :coverage do
11
+ ENV['COVERAGE'] = 'true'
12
+ Rake::Task['test'].execute
13
+ end
@@ -0,0 +1,78 @@
1
+ require "rypto"
2
+
3
+ module Rypto
4
+ # Used internally by {Rypto::Hand} to generate solutions
5
+ class BruteForceSolver
6
+ attr_reader :hand
7
+
8
+ # @private
9
+ def initialize(hand)
10
+ @hand = hand
11
+ @solution = Solution.new(@hand.target_card)
12
+ end
13
+
14
+ # Generate solutions to a {Rypto::Hand}
15
+ # @private
16
+ def solve
17
+ ops = %w{+ - * /}
18
+
19
+ @hand.krypto_cards.permutation.each do |cards|
20
+ ops.each { |op1| ops.each { |op2| ops.each { |op3| ops.each { |op4|
21
+ check_exprs cards, op1, op2, op3, op4
22
+ }}}}
23
+ end
24
+
25
+ @solution
26
+ end
27
+
28
+ private
29
+
30
+ def check_exprs(cards, op1, op2, op3, op4)
31
+ [
32
+ [cards[0], cards[1], cards[2], cards[3], op1, cards[4], op2, op3, op4],
33
+ [cards[0], cards[1], cards[2], op1, cards[3], cards[4], op2, op3, op4],
34
+ [cards[0], cards[1], op1, cards[2], op2, cards[3], cards[4], op3, op4],
35
+ [cards[0], cards[1], op1, cards[2], op2, cards[3], op3, cards[4], op4],
36
+ [cards[0], cards[1], cards[2], cards[3], cards[4], op1, op2, op3, op4],
37
+ [cards[0], cards[1], cards[2], op1, cards[3], op2, op3, cards[4], op4],
38
+ [cards[0], cards[1], cards[2], op1, op2, cards[3], cards[4], op3, op4],
39
+ [cards[0], cards[1], cards[2], op1, op2, cards[3], op3, cards[4], op4],
40
+ [cards[0], cards[1], op1, cards[2], cards[3], cards[4], op2, op3, op4],
41
+ [cards[0], cards[1], cards[2], op1, cards[3], op2, cards[4], op3, op4],
42
+ [cards[0], cards[1], cards[2], cards[3], op1, op2, cards[4], op3, op4],
43
+ [cards[0], cards[1], cards[2], cards[3], op1, op2, op3, cards[4], op4],
44
+ [cards[0], cards[1], op1, cards[2], cards[3], op2, cards[4], op3, op4],
45
+ [cards[0], cards[1], op1, cards[2], cards[3], op2, op3, cards[4], op4]
46
+ ].each do |expr|
47
+ @solution.push(expr) if check_expr(expr)
48
+ end
49
+ end
50
+
51
+ # Assumes valid postfix expression
52
+ def check_expr(expr)
53
+ stack = []
54
+
55
+ expr.each do |e|
56
+ if e.is_a? Fixnum
57
+ stack.push e
58
+ else
59
+ b = stack.pop
60
+ a = stack.pop
61
+
62
+ case e
63
+ when '+' then stack.push(a + b)
64
+ when '*' then stack.push(a * b)
65
+ when '-' then
66
+ return false if b > a
67
+ stack.push(a - b)
68
+ else
69
+ return false if b == 0 or a % b != 0
70
+ stack.push(a / b)
71
+ end
72
+ end
73
+ end
74
+
75
+ stack.pop == @hand.target_card
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,68 @@
1
+ require "rypto"
2
+
3
+ module Rypto
4
+ # Solution returned by {Rypto::Hand#solve}
5
+ class Solution
6
+ # @private
7
+ def initialize(target)
8
+ @target = target
9
+ @solutions = []
10
+ end
11
+
12
+ # Array of all solutions in postfix notation.
13
+ # @return [Array<String>]
14
+ def postfix
15
+ @solutions.map do |solution|
16
+ '%s = %d' % [solution.join(" "), @target]
17
+ end
18
+ end
19
+
20
+ # Array of all solutions in infix notation.
21
+ # @return [Array<String>]
22
+ def infix
23
+ @solutions.map do |solution|
24
+ stack = []
25
+
26
+ solution.each do |s|
27
+ if s.is_a? Fixnum
28
+ stack.push s
29
+ else
30
+ b = stack.pop
31
+ a = stack.pop
32
+ stack.push left: a, op: s, right: b
33
+ end
34
+ end
35
+
36
+ '%s = %d' % [expr_tree_to_infix(stack.pop), @target]
37
+ end
38
+ end
39
+
40
+ # Add solution to list of possible solutions
41
+ # @private
42
+ def push(solution)
43
+ @solutions << solution
44
+ end
45
+
46
+ private
47
+
48
+ def expr_tree_to_infix(node, parent_node = nil)
49
+ return node.to_s if node.is_a? Fixnum
50
+ use_parens = parent_node && op_precedence(parent_node[:op]) > op_precedence(node[:op])
51
+ '%s%s %s %s%s' % [
52
+ use_parens ? '(' : nil,
53
+ expr_tree_to_infix(node[:left], node),
54
+ node[:op],
55
+ expr_tree_to_infix(node[:right], node),
56
+ use_parens ? ')' : nil
57
+ ]
58
+ end
59
+
60
+ def op_precedence(op)
61
+ case op
62
+ when '/', '*' then 2
63
+ else
64
+ 1
65
+ end
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,4 @@
1
+ module Rypto
2
+ # Rypto library version
3
+ VERSION = "0.1.0"
4
+ end
data/lib/rypto.rb ADDED
@@ -0,0 +1,111 @@
1
+ require "rypto/version"
2
+ require "rypto/solution"
3
+ require "rypto/brute_force_solver"
4
+
5
+ # Top level module for the Rypto library
6
+ module Rypto
7
+ # A individual hand of Krypto
8
+ #
9
+ # @!attribute krypto_cards [r]
10
+ # @return [Array(Fixnum, Fixnum, Fixnum, Fixnum, Fixnum)] the five krypto cards to evaluate
11
+ #
12
+ # @!attribute target_card [r]
13
+ # @return [Fixnum] the target card that the expression made from
14
+ # the five krypto_cards should equal
15
+ class Hand
16
+ attr_reader :krypto_cards, :target_card
17
+
18
+ # May be called with 0 or 2 arguments. If called with 0
19
+ # arguments, will return a random deal from a full {Rypto::Deck}. If
20
+ # called with 2 arguments, will create a hand from the specified
21
+ # values.
22
+ #
23
+ # @param krypto_cards [Array(Fixnum, Fixnum, Fixnum, Fixnum, Fixnum)]
24
+ # Array of five krypto card values
25
+ # @param target_card [Fixnum]
26
+ # Target card value
27
+ def initialize(krypto_cards = nil, target_card = nil)
28
+ if !krypto_cards.nil? and target_card.nil?
29
+ raise ArgumentError, "Rypto::Hand#new must be called with 0 or 2 arguments"
30
+ end
31
+
32
+ if krypto_cards.nil?
33
+ cards = Deck.new.deal_cards
34
+ @krypto_cards = cards[0, 5]
35
+ @target_card = cards[5]
36
+ else
37
+ unless krypto_cards.is_a?(Array) and krypto_cards.size == 5
38
+ raise ArgumentError, "Expected first argument to be an array of 5 integers"
39
+ end
40
+
41
+ tmp_deck = Deck.new
42
+ krypto_cards.each {|card| tmp_deck.draw_card card}
43
+ tmp_deck.draw_card target_card
44
+
45
+ @krypto_cards = krypto_cards
46
+ @target_card = target_card
47
+ end
48
+ end
49
+
50
+ # Get all possible solutions for the hand
51
+ # @return [Solution]
52
+ def solve
53
+ BruteForceSolver.new(self).solve
54
+ end
55
+ end
56
+
57
+ # A Krypto {Rypto::Deck} contains 56 numeric cards. Three each of numbers
58
+ # 1 through 6, four each of 7 through 10, two each of 11 through
59
+ # 17, and one each of 18 through 25.
60
+ #
61
+ # @!attribute cards [r]
62
+ # @return [Array<Fixnum>] all the card values left in the deck
63
+ class Deck
64
+ attr_reader :cards
65
+
66
+ # Create a randomized deck of Krypto cards
67
+ def initialize
68
+ @cards = ((1..6).to_a * 3 + (7..10).to_a * 4 + (11..17).to_a * 2 + (18..25).to_a).shuffle
69
+ end
70
+
71
+ # Draw a single card from the deck
72
+ #
73
+ # @param cards [Fixnum] the card value to draw
74
+ # @return [Fixnum] the card value that was drawn
75
+ # @raise [ArgumentError] if the card is not in the deck
76
+ def draw_card(card)
77
+ index = @cards.index card
78
+ raise ArgumentError, "#{card} is not in the deck" if index.nil?
79
+ @cards.delete_at index
80
+ end
81
+
82
+ # Deal six raw card values from the deck
83
+ #
84
+ # @return [Array(Fixnum, Fixnum, Fixnum, Fixnum, Fixnum, Fixnum)] a random hand from the deck
85
+ # @raise [RuntimeError] if there are not enough cards to deal a full hand in the deck
86
+ def deal_cards
87
+ raise "Not enough cards to deal a hand" unless can_deal?
88
+ @cards.slice!(0, 6)
89
+ end
90
+
91
+ # Deal a {Rypto::Hand} from the deck
92
+ # @return [Hand] a random hand from the deck
93
+ # @raise [RuntimeError] if there are not enough cards to deal a full hand in the deck
94
+ def deal_hand
95
+ cards = deal_cards
96
+ Hand.new(cards[0, 5], cards[5])
97
+ end
98
+
99
+ # Size of the deck
100
+ # @return [Fixnum] number of cards left in the deck
101
+ def size
102
+ @cards.size
103
+ end
104
+
105
+ # Check if there are enough cards left to deal a new hand
106
+ # @return [Boolean]
107
+ def can_deal?
108
+ size() >= 6
109
+ end
110
+ end
111
+ end
data/rypto.gemspec ADDED
@@ -0,0 +1,30 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'rypto/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "rypto"
8
+ spec.version = Rypto::VERSION
9
+ spec.authors = ["Joe Sortelli"]
10
+ spec.email = ["joe@sortelli.com"]
11
+ spec.summary = "Krypto card game solver."
12
+ spec.description = %q{
13
+ A library that provides an API for solving hands from the Krypto
14
+ card game. See http://en.wikipedia.org/wiki/Krypto_%28game%29
15
+ for a description of Krypto.
16
+ }
17
+ spec.homepage = "https://github.com/sortelli/rypto"
18
+ spec.license = "MIT"
19
+
20
+ spec.files = `git ls-files -z`.split("\x0")
21
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
22
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
23
+ spec.require_paths = ["lib"]
24
+
25
+ spec.add_development_dependency "bundler", "~> 1.7"
26
+ spec.add_development_dependency "rake", "~> 10.0"
27
+ spec.add_development_dependency "minitest", "~> 5.5"
28
+ spec.add_development_dependency "simplecov"
29
+ spec.add_development_dependency "yard"
30
+ end
data/test/test_deck.rb ADDED
@@ -0,0 +1,38 @@
1
+ require_relative "test_helper"
2
+
3
+ class TestHand < Minitest::Test
4
+ def test_deck
5
+ deck = Rypto::Deck.new
6
+ cards = (1..6).to_a * 3 + (7..10).to_a * 4 + (11..17).to_a * 2 + (18..25).to_a
7
+ assert_equal cards.sort, deck.cards.sort
8
+
9
+ assert_equal 1, deck.draw_card(1)
10
+ assert_equal 1, deck.draw_card(1)
11
+ assert_equal 1, deck.draw_card(1)
12
+ assert_raises(ArgumentError) { deck.draw_card 1 }
13
+
14
+ assert_instance_of Array, deck.deal_cards
15
+ assert_equal 6, deck.deal_cards.size
16
+
17
+ assert_instance_of Rypto::Hand, deck.deal_hand
18
+ end
19
+
20
+ def test_full_deal
21
+ deck = Rypto::Deck.new
22
+
23
+ assert deck.can_deal?
24
+ 9.times { deck.deal_hand }
25
+ assert !deck.can_deal?
26
+
27
+ assert_equal 2, deck.cards.size
28
+
29
+ exp = assert_raises(RuntimeError) { deck.deal_hand }
30
+ assert_equal "Not enough cards to deal a hand", exp.message
31
+ end
32
+
33
+ def test_bad_arguments
34
+ assert_raises(ArgumentError) { Rypto::Deck.new 1 }
35
+ assert_raises(ArgumentError) { Rypto::Deck.new.draw_card 'a' }
36
+ assert_raises(ArgumentError) { Rypto::Deck.new.draw_card 26 }
37
+ end
38
+ end
data/test/test_hand.rb ADDED
@@ -0,0 +1,29 @@
1
+ require_relative "test_helper"
2
+
3
+ class TestHand < Minitest::Test
4
+ def test_hand
5
+ krypto_cards = [1, 2, 3, 4, 5]
6
+ target_card = 6
7
+ hand = Rypto::Hand.new krypto_cards, target_card
8
+ assert_equal krypto_cards, hand.krypto_cards
9
+ assert_equal target_card, hand.target_card
10
+
11
+ assert_instance_of Array, Rypto::Hand.new.krypto_cards
12
+ assert_instance_of Fixnum, Rypto::Hand.new.target_card
13
+ end
14
+
15
+ def test_bad_arguments
16
+ assert_raises(ArgumentError) { Rypto::Hand.new 1 }
17
+ assert_raises(ArgumentError) { Rypto::Hand.new 1, 2 }
18
+ assert_raises(ArgumentError) { Rypto::Hand.new [1], 2 }
19
+
20
+ assert_raises(ArgumentError) { Rypto::Hand.new [ 1, 2, 3, 4, 5] }
21
+ assert_raises(ArgumentError) { Rypto::Hand.new [ 1, 2, 3, 4, 5], 'a' }
22
+ assert_raises(ArgumentError) { Rypto::Hand.new [ 1, 1, 1, 1, 2], 6 }
23
+ assert_raises(ArgumentError) { Rypto::Hand.new [ 7, 7, 7, 7, 7], 6 }
24
+ assert_raises(ArgumentError) { Rypto::Hand.new [ 1, 1, 1, 3, 4], 1 }
25
+ assert_raises(ArgumentError) { Rypto::Hand.new [ 1, 2, 3, 4, 5], 26 }
26
+ assert_raises(ArgumentError) { Rypto::Hand.new [12, 12, 3, 4, 5], 12 }
27
+ assert_raises(ArgumentError) { Rypto::Hand.new [25, 25, 3, 4, 5], 12 }
28
+ end
29
+ end
@@ -0,0 +1,10 @@
1
+ if ENV["COVERAGE"]
2
+ require "simplecov"
3
+ SimpleCov.start do
4
+ add_filter "test"
5
+ command_name "Mintest"
6
+ end
7
+ end
8
+
9
+ require "minitest/autorun"
10
+ require "rypto"
@@ -0,0 +1,603 @@
1
+ require_relative "test_helper"
2
+
3
+ class TestHand < Minitest::Test
4
+ def test_solution_1
5
+ hand = Rypto::Hand.new([6, 16, 9, 15, 5], 22)
6
+ solution = hand.solve
7
+
8
+ assert_instance_of Rypto::Solution, solution
9
+ assert_equal solution_1, solution.postfix.sort
10
+ end
11
+
12
+ def test_solution_2
13
+ hand = Rypto::Hand.new [3, 23, 13, 16, 1], 20
14
+ solution = hand.solve
15
+
16
+ assert_instance_of Rypto::Solution, solution
17
+ assert_equal [], solution.postfix.sort
18
+ end
19
+
20
+ def test_solution_3
21
+ hand = Rypto::Hand.new [9, 22, 20, 4, 4], 8
22
+ solution = hand.solve
23
+
24
+ assert_instance_of Rypto::Solution, solution
25
+ assert_equal solution_3, solution.infix.sort
26
+ end
27
+
28
+ def solution_1
29
+ [
30
+ "15 16 + 6 5 - * 9 - = 22",
31
+ "15 16 + 6 5 - / 9 - = 22",
32
+ "15 16 + 6 5 - 9 * - = 22",
33
+ "15 16 + 9 - 6 5 - * = 22",
34
+ "15 16 + 9 - 6 5 - / = 22",
35
+ "15 16 + 9 6 5 - * - = 22",
36
+ "15 16 + 9 6 5 - / - = 22",
37
+ "15 16 5 + 9 6 - / + = 22",
38
+ "15 16 6 - 5 / - 9 + = 22",
39
+ "15 16 6 5 - * + 9 - = 22",
40
+ "15 16 6 5 - * 9 - + = 22",
41
+ "15 16 6 5 - / + 9 - = 22",
42
+ "15 16 6 5 - / 9 - + = 22",
43
+ "15 16 6 5 - 9 * - + = 22",
44
+ "15 16 9 - + 6 5 - * = 22",
45
+ "15 16 9 - + 6 5 - / = 22",
46
+ "15 16 9 - 6 5 - * + = 22",
47
+ "15 16 9 - 6 5 - / + = 22",
48
+ "15 16 9 6 5 - * - + = 22",
49
+ "15 16 9 6 5 - / - + = 22",
50
+ "15 5 - 9 - 16 * 6 + = 22",
51
+ "15 5 - 9 - 16 6 + * = 22",
52
+ "15 5 - 9 - 6 * 16 + = 22",
53
+ "15 5 - 9 - 6 16 + * = 22",
54
+ "15 5 / 16 + 6 - 9 + = 22",
55
+ "15 5 / 16 + 9 + 6 - = 22",
56
+ "15 5 / 16 + 9 6 - + = 22",
57
+ "15 5 / 16 6 - + 9 + = 22",
58
+ "15 5 / 16 6 - 9 + + = 22",
59
+ "15 5 / 16 9 + + 6 - = 22",
60
+ "15 5 / 16 9 + 6 - + = 22",
61
+ "15 5 / 16 9 6 - + + = 22",
62
+ "15 5 / 9 + 16 + 6 - = 22",
63
+ "15 5 / 9 + 16 6 - + = 22",
64
+ "15 5 / 9 + 6 - 16 + = 22",
65
+ "15 5 / 9 16 + + 6 - = 22",
66
+ "15 5 / 9 16 + 6 - + = 22",
67
+ "15 5 / 9 16 6 - + + = 22",
68
+ "15 5 / 9 6 - + 16 + = 22",
69
+ "15 5 / 9 6 - 16 + + = 22",
70
+ "15 5 16 + 9 6 - / + = 22",
71
+ "15 5 9 + - 16 * 6 + = 22",
72
+ "15 5 9 + - 16 6 + * = 22",
73
+ "15 5 9 + - 6 * 16 + = 22",
74
+ "15 5 9 + - 6 16 + * = 22",
75
+ "15 6 + 9 + 5 / 16 + = 22",
76
+ "15 6 - 9 / 16 + 5 + = 22",
77
+ "15 6 - 9 / 16 5 + + = 22",
78
+ "15 6 - 9 / 5 + 16 + = 22",
79
+ "15 6 - 9 / 5 16 + + = 22",
80
+ "15 6 5 - * 16 + 9 - = 22",
81
+ "15 6 5 - * 16 9 - + = 22",
82
+ "15 6 5 - * 9 - 16 + = 22",
83
+ "15 6 5 - / 16 + 9 - = 22",
84
+ "15 6 5 - / 16 9 - + = 22",
85
+ "15 6 5 - / 9 - 16 + = 22",
86
+ "15 6 5 - 16 * + 9 - = 22",
87
+ "15 6 5 - 16 * 9 - + = 22",
88
+ "15 6 5 - 16 9 - * + = 22",
89
+ "15 6 5 - 9 * - 16 + = 22",
90
+ "15 6 9 + + 5 / 16 + = 22",
91
+ "15 6 9 + / 16 + 5 + = 22",
92
+ "15 6 9 + / 16 5 + + = 22",
93
+ "15 6 9 + / 5 + 16 + = 22",
94
+ "15 6 9 + / 5 16 + + = 22",
95
+ "15 9 + 16 6 - 5 / - = 22",
96
+ "15 9 + 6 + 5 / 16 + = 22",
97
+ "15 9 - 16 + 6 5 - * = 22",
98
+ "15 9 - 16 + 6 5 - / = 22",
99
+ "15 9 - 16 6 5 - * + = 22",
100
+ "15 9 - 16 6 5 - / + = 22",
101
+ "15 9 - 5 - 16 * 6 + = 22",
102
+ "15 9 - 5 - 16 6 + * = 22",
103
+ "15 9 - 5 - 6 * 16 + = 22",
104
+ "15 9 - 5 - 6 16 + * = 22",
105
+ "15 9 - 6 / 16 + 5 + = 22",
106
+ "15 9 - 6 / 16 5 + + = 22",
107
+ "15 9 - 6 / 5 + 16 + = 22",
108
+ "15 9 - 6 / 5 16 + + = 22",
109
+ "15 9 - 6 5 - * 16 + = 22",
110
+ "15 9 - 6 5 - / 16 + = 22",
111
+ "15 9 - 6 5 - 16 * + = 22",
112
+ "15 9 16 6 - 5 / - + = 22",
113
+ "15 9 5 + - 16 * 6 + = 22",
114
+ "15 9 5 + - 16 6 + * = 22",
115
+ "15 9 5 + - 6 * 16 + = 22",
116
+ "15 9 5 + - 6 16 + * = 22",
117
+ "15 9 6 + + 5 / 16 + = 22",
118
+ "15 9 6 + / 16 + 5 + = 22",
119
+ "15 9 6 + / 16 5 + + = 22",
120
+ "15 9 6 + / 5 + 16 + = 22",
121
+ "15 9 6 + / 5 16 + + = 22",
122
+ "15 9 6 5 - * - 16 + = 22",
123
+ "15 9 6 5 - / - 16 + = 22",
124
+ "16 15 + 6 5 - * 9 - = 22",
125
+ "16 15 + 6 5 - / 9 - = 22",
126
+ "16 15 + 6 5 - 9 * - = 22",
127
+ "16 15 + 9 - 6 5 - * = 22",
128
+ "16 15 + 9 - 6 5 - / = 22",
129
+ "16 15 + 9 6 5 - * - = 22",
130
+ "16 15 + 9 6 5 - / - = 22",
131
+ "16 15 - 5 6 * + 9 - = 22",
132
+ "16 15 - 5 6 * 9 - + = 22",
133
+ "16 15 - 6 5 * + 9 - = 22",
134
+ "16 15 - 6 5 * 9 - + = 22",
135
+ "16 15 5 - 9 - * 6 + = 22",
136
+ "16 15 5 - 9 - / 6 + = 22",
137
+ "16 15 5 - 9 - 6 * + = 22",
138
+ "16 15 5 / + 6 - 9 + = 22",
139
+ "16 15 5 / + 9 + 6 - = 22",
140
+ "16 15 5 / + 9 6 - + = 22",
141
+ "16 15 5 / 9 + + 6 - = 22",
142
+ "16 15 5 / 9 + 6 - + = 22",
143
+ "16 15 5 / 9 6 - + + = 22",
144
+ "16 15 5 9 + - * 6 + = 22",
145
+ "16 15 5 9 + - / 6 + = 22",
146
+ "16 15 5 9 + - 6 * + = 22",
147
+ "16 15 6 + 9 + 5 / + = 22",
148
+ "16 15 6 - 9 / + 5 + = 22",
149
+ "16 15 6 - 9 / 5 + + = 22",
150
+ "16 15 6 5 - * + 9 - = 22",
151
+ "16 15 6 5 - * 9 - + = 22",
152
+ "16 15 6 5 - / + 9 - = 22",
153
+ "16 15 6 5 - / 9 - + = 22",
154
+ "16 15 6 5 - 9 * - + = 22",
155
+ "16 15 6 9 + + 5 / + = 22",
156
+ "16 15 6 9 + / + 5 + = 22",
157
+ "16 15 6 9 + / 5 + + = 22",
158
+ "16 15 9 + 6 + 5 / + = 22",
159
+ "16 15 9 - + 6 5 - * = 22",
160
+ "16 15 9 - + 6 5 - / = 22",
161
+ "16 15 9 - 5 - * 6 + = 22",
162
+ "16 15 9 - 5 - / 6 + = 22",
163
+ "16 15 9 - 5 - 6 * + = 22",
164
+ "16 15 9 - 6 / + 5 + = 22",
165
+ "16 15 9 - 6 / 5 + + = 22",
166
+ "16 15 9 - 6 5 - * + = 22",
167
+ "16 15 9 - 6 5 - / + = 22",
168
+ "16 15 9 5 + - * 6 + = 22",
169
+ "16 15 9 5 + - / 6 + = 22",
170
+ "16 15 9 5 + - 6 * + = 22",
171
+ "16 15 9 6 + + 5 / + = 22",
172
+ "16 15 9 6 + / + 5 + = 22",
173
+ "16 15 9 6 + / 5 + + = 22",
174
+ "16 15 9 6 5 - * - + = 22",
175
+ "16 15 9 6 5 - / - + = 22",
176
+ "16 5 + 15 6 - 9 / + = 22",
177
+ "16 5 + 15 6 9 + / + = 22",
178
+ "16 5 + 15 9 - 6 / + = 22",
179
+ "16 5 + 15 9 6 + / + = 22",
180
+ "16 5 + 6 15 9 - / + = 22",
181
+ "16 5 + 6 9 + 15 / + = 22",
182
+ "16 5 + 9 15 6 - / + = 22",
183
+ "16 5 + 9 6 + 15 / + = 22",
184
+ "16 5 + 9 6 - / 15 + = 22",
185
+ "16 5 15 6 - 9 / + + = 22",
186
+ "16 5 15 6 9 + / + + = 22",
187
+ "16 5 15 9 - 6 / + + = 22",
188
+ "16 5 15 9 6 + / + + = 22",
189
+ "16 5 6 * + 15 - 9 - = 22",
190
+ "16 5 6 * + 15 9 + - = 22",
191
+ "16 5 6 * + 9 - 15 - = 22",
192
+ "16 5 6 * + 9 15 + - = 22",
193
+ "16 5 6 * 15 - + 9 - = 22",
194
+ "16 5 6 * 15 - 9 - + = 22",
195
+ "16 5 6 * 15 9 + - + = 22",
196
+ "16 5 6 * 9 - + 15 - = 22",
197
+ "16 5 6 * 9 - 15 - + = 22",
198
+ "16 5 6 * 9 15 + - + = 22",
199
+ "16 5 6 15 9 - / + + = 22",
200
+ "16 5 6 9 + 15 / + + = 22",
201
+ "16 5 9 15 6 - / + + = 22",
202
+ "16 5 9 6 + 15 / + + = 22",
203
+ "16 6 + 15 5 - 9 - * = 22",
204
+ "16 6 + 15 5 - 9 - / = 22",
205
+ "16 6 + 15 5 9 + - * = 22",
206
+ "16 6 + 15 5 9 + - / = 22",
207
+ "16 6 + 15 9 - 5 - * = 22",
208
+ "16 6 + 15 9 - 5 - / = 22",
209
+ "16 6 + 15 9 5 + - * = 22",
210
+ "16 6 + 15 9 5 + - / = 22",
211
+ "16 6 - 15 5 / + 9 + = 22",
212
+ "16 6 - 15 5 / 9 + + = 22",
213
+ "16 6 - 9 + 15 5 / + = 22",
214
+ "16 6 - 9 15 5 / + + = 22",
215
+ "16 6 15 + 9 + 5 / + = 22",
216
+ "16 6 15 5 - 9 - * + = 22",
217
+ "16 6 15 5 - 9 - / + = 22",
218
+ "16 6 15 5 / - - 9 + = 22",
219
+ "16 6 15 5 9 + - * + = 22",
220
+ "16 6 15 5 9 + - / + = 22",
221
+ "16 6 15 9 + + 5 / + = 22",
222
+ "16 6 15 9 - / + 5 + = 22",
223
+ "16 6 15 9 - / 5 + + = 22",
224
+ "16 6 15 9 - 5 - * + = 22",
225
+ "16 6 15 9 - 5 - / + = 22",
226
+ "16 6 15 9 5 + - * + = 22",
227
+ "16 6 15 9 5 + - / + = 22",
228
+ "16 6 5 * + 15 - 9 - = 22",
229
+ "16 6 5 * + 15 9 + - = 22",
230
+ "16 6 5 * + 9 - 15 - = 22",
231
+ "16 6 5 * + 9 15 + - = 22",
232
+ "16 6 5 * 15 - + 9 - = 22",
233
+ "16 6 5 * 15 - 9 - + = 22",
234
+ "16 6 5 * 15 9 + - + = 22",
235
+ "16 6 5 * 9 - + 15 - = 22",
236
+ "16 6 5 * 9 - 15 - + = 22",
237
+ "16 6 5 * 9 15 + - + = 22",
238
+ "16 6 5 - * 15 + 9 - = 22",
239
+ "16 6 5 - * 15 9 - + = 22",
240
+ "16 6 5 - * 9 - 15 + = 22",
241
+ "16 6 5 - / 15 + 9 - = 22",
242
+ "16 6 5 - / 15 9 - + = 22",
243
+ "16 6 5 - / 9 - 15 + = 22",
244
+ "16 6 5 - 15 * + 9 - = 22",
245
+ "16 6 5 - 15 * 9 - + = 22",
246
+ "16 6 5 - 15 9 - * + = 22",
247
+ "16 6 5 - 9 * - 15 + = 22",
248
+ "16 6 9 + 15 + 5 / + = 22",
249
+ "16 6 9 + 15 / + 5 + = 22",
250
+ "16 6 9 + 15 / 5 + + = 22",
251
+ "16 6 9 15 + + 5 / + = 22",
252
+ "16 9 + 15 5 / + 6 - = 22",
253
+ "16 9 + 6 - 15 5 / + = 22",
254
+ "16 9 + 6 15 5 / - - = 22",
255
+ "16 9 - 15 + 6 5 - * = 22",
256
+ "16 9 - 15 + 6 5 - / = 22",
257
+ "16 9 - 15 6 5 - * + = 22",
258
+ "16 9 - 15 6 5 - / + = 22",
259
+ "16 9 - 5 6 * + 15 - = 22",
260
+ "16 9 - 5 6 * 15 - + = 22",
261
+ "16 9 - 6 * 15 - 5 - = 22",
262
+ "16 9 - 6 * 15 5 + - = 22",
263
+ "16 9 - 6 * 5 - 15 - = 22",
264
+ "16 9 - 6 * 5 15 + - = 22",
265
+ "16 9 - 6 5 * + 15 - = 22",
266
+ "16 9 - 6 5 * 15 - + = 22",
267
+ "16 9 - 6 5 - * 15 + = 22",
268
+ "16 9 - 6 5 - / 15 + = 22",
269
+ "16 9 - 6 5 - 15 * + = 22",
270
+ "16 9 15 + 6 + 5 / + = 22",
271
+ "16 9 15 5 / + + 6 - = 22",
272
+ "16 9 15 5 / + 6 - + = 22",
273
+ "16 9 15 6 + + 5 / + = 22",
274
+ "16 9 15 6 - / + 5 + = 22",
275
+ "16 9 15 6 - / 5 + + = 22",
276
+ "16 9 6 + 15 + 5 / + = 22",
277
+ "16 9 6 + 15 / + 5 + = 22",
278
+ "16 9 6 + 15 / 5 + + = 22",
279
+ "16 9 6 - + 15 5 / + = 22",
280
+ "16 9 6 - 15 5 / + + = 22",
281
+ "16 9 6 15 + + 5 / + = 22",
282
+ "16 9 6 15 5 / - - + = 22",
283
+ "16 9 6 5 - * - 15 + = 22",
284
+ "16 9 6 5 - / - 15 + = 22",
285
+ "5 15 6 - 9 / + 16 + = 22",
286
+ "5 15 6 - 9 / 16 + + = 22",
287
+ "5 15 6 9 + / + 16 + = 22",
288
+ "5 15 6 9 + / 16 + + = 22",
289
+ "5 15 9 - 6 / + 16 + = 22",
290
+ "5 15 9 - 6 / 16 + + = 22",
291
+ "5 15 9 6 + / + 16 + = 22",
292
+ "5 15 9 6 + / 16 + + = 22",
293
+ "5 16 + 15 6 - 9 / + = 22",
294
+ "5 16 + 15 6 9 + / + = 22",
295
+ "5 16 + 15 9 - 6 / + = 22",
296
+ "5 16 + 15 9 6 + / + = 22",
297
+ "5 16 + 6 15 9 - / + = 22",
298
+ "5 16 + 6 9 + 15 / + = 22",
299
+ "5 16 + 9 15 6 - / + = 22",
300
+ "5 16 + 9 6 + 15 / + = 22",
301
+ "5 16 + 9 6 - / 15 + = 22",
302
+ "5 16 15 6 - 9 / + + = 22",
303
+ "5 16 15 6 9 + / + + = 22",
304
+ "5 16 15 9 - 6 / + + = 22",
305
+ "5 16 15 9 6 + / + + = 22",
306
+ "5 16 6 15 9 - / + + = 22",
307
+ "5 16 6 9 + 15 / + + = 22",
308
+ "5 16 9 15 6 - / + + = 22",
309
+ "5 16 9 6 + 15 / + + = 22",
310
+ "5 6 * 15 - 16 + 9 - = 22",
311
+ "5 6 * 15 - 16 9 - + = 22",
312
+ "5 6 * 15 - 9 - 16 + = 22",
313
+ "5 6 * 15 16 9 - - - = 22",
314
+ "5 6 * 15 9 + - 16 + = 22",
315
+ "5 6 * 15 9 + 16 - - = 22",
316
+ "5 6 * 16 + 15 - 9 - = 22",
317
+ "5 6 * 16 + 15 9 + - = 22",
318
+ "5 6 * 16 + 9 - 15 - = 22",
319
+ "5 6 * 16 + 9 15 + - = 22",
320
+ "5 6 * 16 15 - + 9 - = 22",
321
+ "5 6 * 16 9 - + 15 - = 22",
322
+ "5 6 * 9 - 15 - 16 + = 22",
323
+ "5 6 * 9 - 16 + 15 - = 22",
324
+ "5 6 * 9 - 16 15 - + = 22",
325
+ "5 6 * 9 15 + - 16 + = 22",
326
+ "5 6 * 9 15 + 16 - - = 22",
327
+ "5 6 * 9 16 15 - - - = 22",
328
+ "5 6 15 9 - / + 16 + = 22",
329
+ "5 6 15 9 - / 16 + + = 22",
330
+ "5 6 9 + 15 / + 16 + = 22",
331
+ "5 6 9 + 15 / 16 + + = 22",
332
+ "5 9 15 6 - / + 16 + = 22",
333
+ "5 9 15 6 - / 16 + + = 22",
334
+ "5 9 6 + 15 / + 16 + = 22",
335
+ "5 9 6 + 15 / 16 + + = 22",
336
+ "6 15 + 9 + 5 / 16 + = 22",
337
+ "6 15 5 - 9 - * 16 + = 22",
338
+ "6 15 5 - 9 - / 16 + = 22",
339
+ "6 15 5 - 9 - 16 * + = 22",
340
+ "6 15 5 9 + - * 16 + = 22",
341
+ "6 15 5 9 + - / 16 + = 22",
342
+ "6 15 5 9 + - 16 * + = 22",
343
+ "6 15 9 + + 5 / 16 + = 22",
344
+ "6 15 9 - / 16 + 5 + = 22",
345
+ "6 15 9 - / 16 5 + + = 22",
346
+ "6 15 9 - / 5 + 16 + = 22",
347
+ "6 15 9 - / 5 16 + + = 22",
348
+ "6 15 9 - 5 - * 16 + = 22",
349
+ "6 15 9 - 5 - / 16 + = 22",
350
+ "6 15 9 - 5 - 16 * + = 22",
351
+ "6 15 9 5 + - * 16 + = 22",
352
+ "6 15 9 5 + - / 16 + = 22",
353
+ "6 15 9 5 + - 16 * + = 22",
354
+ "6 16 + 15 5 - 9 - * = 22",
355
+ "6 16 + 15 5 - 9 - / = 22",
356
+ "6 16 + 15 5 9 + - * = 22",
357
+ "6 16 + 15 5 9 + - / = 22",
358
+ "6 16 + 15 9 - 5 - * = 22",
359
+ "6 16 + 15 9 - 5 - / = 22",
360
+ "6 16 + 15 9 5 + - * = 22",
361
+ "6 16 + 15 9 5 + - / = 22",
362
+ "6 16 15 5 - 9 - * + = 22",
363
+ "6 16 15 5 - 9 - / + = 22",
364
+ "6 16 15 5 9 + - * + = 22",
365
+ "6 16 15 5 9 + - / + = 22",
366
+ "6 16 15 9 - 5 - * + = 22",
367
+ "6 16 15 9 - 5 - / + = 22",
368
+ "6 16 15 9 5 + - * + = 22",
369
+ "6 16 15 9 5 + - / + = 22",
370
+ "6 16 9 - * 15 - 5 - = 22",
371
+ "6 16 9 - * 15 5 + - = 22",
372
+ "6 16 9 - * 5 - 15 - = 22",
373
+ "6 16 9 - * 5 15 + - = 22",
374
+ "6 5 * 15 - 16 + 9 - = 22",
375
+ "6 5 * 15 - 16 9 - + = 22",
376
+ "6 5 * 15 - 9 - 16 + = 22",
377
+ "6 5 * 15 16 9 - - - = 22",
378
+ "6 5 * 15 9 + - 16 + = 22",
379
+ "6 5 * 15 9 + 16 - - = 22",
380
+ "6 5 * 16 + 15 - 9 - = 22",
381
+ "6 5 * 16 + 15 9 + - = 22",
382
+ "6 5 * 16 + 9 - 15 - = 22",
383
+ "6 5 * 16 + 9 15 + - = 22",
384
+ "6 5 * 16 15 - + 9 - = 22",
385
+ "6 5 * 16 9 - + 15 - = 22",
386
+ "6 5 * 9 - 15 - 16 + = 22",
387
+ "6 5 * 9 - 16 + 15 - = 22",
388
+ "6 5 * 9 - 16 15 - + = 22",
389
+ "6 5 * 9 15 + - 16 + = 22",
390
+ "6 5 * 9 15 + 16 - - = 22",
391
+ "6 5 * 9 16 15 - - - = 22",
392
+ "6 5 - 15 * 16 + 9 - = 22",
393
+ "6 5 - 15 * 16 9 - + = 22",
394
+ "6 5 - 15 * 9 - 16 + = 22",
395
+ "6 5 - 15 16 + * 9 - = 22",
396
+ "6 5 - 15 16 + 9 - * = 22",
397
+ "6 5 - 15 16 9 - + * = 22",
398
+ "6 5 - 15 9 - * 16 + = 22",
399
+ "6 5 - 15 9 - 16 + * = 22",
400
+ "6 5 - 16 * 15 + 9 - = 22",
401
+ "6 5 - 16 * 15 9 - + = 22",
402
+ "6 5 - 16 * 9 - 15 + = 22",
403
+ "6 5 - 16 15 + * 9 - = 22",
404
+ "6 5 - 16 15 + 9 - * = 22",
405
+ "6 5 - 16 15 9 - + * = 22",
406
+ "6 5 - 16 9 - * 15 + = 22",
407
+ "6 5 - 16 9 - 15 + * = 22",
408
+ "6 9 + 15 + 5 / 16 + = 22",
409
+ "6 9 + 15 / 16 + 5 + = 22",
410
+ "6 9 + 15 / 16 5 + + = 22",
411
+ "6 9 + 15 / 5 + 16 + = 22",
412
+ "6 9 + 15 / 5 16 + + = 22",
413
+ "6 9 15 + + 5 / 16 + = 22",
414
+ "9 15 + 16 6 - 5 / - = 22",
415
+ "9 15 + 6 + 5 / 16 + = 22",
416
+ "9 15 16 6 - 5 / - + = 22",
417
+ "9 15 5 / + 16 + 6 - = 22",
418
+ "9 15 5 / + 16 6 - + = 22",
419
+ "9 15 5 / + 6 - 16 + = 22",
420
+ "9 15 5 / 16 + + 6 - = 22",
421
+ "9 15 5 / 16 + 6 - + = 22",
422
+ "9 15 5 / 16 6 - + + = 22",
423
+ "9 15 6 + + 5 / 16 + = 22",
424
+ "9 15 6 - / 16 + 5 + = 22",
425
+ "9 15 6 - / 16 5 + + = 22",
426
+ "9 15 6 - / 5 + 16 + = 22",
427
+ "9 15 6 - / 5 16 + + = 22",
428
+ "9 16 + 15 5 / + 6 - = 22",
429
+ "9 16 + 6 - 15 5 / + = 22",
430
+ "9 16 + 6 15 5 / - - = 22",
431
+ "9 16 15 5 / + + 6 - = 22",
432
+ "9 16 15 5 / + 6 - + = 22",
433
+ "9 16 6 - + 15 5 / + = 22",
434
+ "9 16 6 - 15 5 / + + = 22",
435
+ "9 16 6 - 5 / - 15 + = 22",
436
+ "9 16 6 15 5 / - - + = 22",
437
+ "9 6 + 15 + 5 / 16 + = 22",
438
+ "9 6 + 15 / 16 + 5 + = 22",
439
+ "9 6 + 15 / 16 5 + + = 22",
440
+ "9 6 + 15 / 5 + 16 + = 22",
441
+ "9 6 + 15 / 5 16 + + = 22",
442
+ "9 6 - 15 5 / + 16 + = 22",
443
+ "9 6 - 15 5 / 16 + + = 22",
444
+ "9 6 - 16 + 15 5 / + = 22",
445
+ "9 6 - 16 15 5 / + + = 22",
446
+ "9 6 15 + + 5 / 16 + = 22",
447
+ "9 6 15 5 / - - 16 + = 22"
448
+ ]
449
+ end
450
+
451
+ def solution_3
452
+ [
453
+ "((22 - 9) * 4 - 20) / 4 = 8",
454
+ "((22 - 9) * 4 - 20) / 4 = 8",
455
+ "(20 + 22 * 4) / 9 - 4 = 8",
456
+ "(20 + 22 * 4) / 9 - 4 = 8",
457
+ "(20 + 4 * 22) / 9 - 4 = 8",
458
+ "(20 + 4 * 22) / 9 - 4 = 8",
459
+ "(20 - 4) * 9 / (22 - 4) = 8",
460
+ "(20 - 4) * 9 / (22 - 4) = 8",
461
+ "(20 - 4) / (22 - 4) / 9 = 8",
462
+ "(20 - 4) / (22 - 4) / 9 = 8",
463
+ "(20 - 9) * 4 * 4 / 22 = 8",
464
+ "(20 - 9) * 4 * 4 / 22 = 8",
465
+ "(20 - 9) * 4 * 4 / 22 = 8",
466
+ "(20 - 9) * 4 * 4 / 22 = 8",
467
+ "(20 - 9) * 4 / 22 * 4 = 8",
468
+ "(20 - 9) * 4 / 22 * 4 = 8",
469
+ "(22 * 4 + 20) / 9 - 4 = 8",
470
+ "(22 * 4 + 20) / 9 - 4 = 8",
471
+ "(22 * 4 + 4 - 20) / 9 = 8",
472
+ "(22 * 4 + 4 - 20) / 9 = 8",
473
+ "(22 * 4 - 20 + 4) / 9 = 8",
474
+ "(22 * 4 - 20 + 4) / 9 = 8",
475
+ "(22 * 4 - 20 - 4) / 9 = 8",
476
+ "(22 * 4 - 20 - 4) / 9 = 8",
477
+ "(22 * 4 - 20) / 4 - 9 = 8",
478
+ "(22 * 4 - 20) / 4 - 9 = 8",
479
+ "(4 * (22 - 9) - 20) / 4 = 8",
480
+ "(4 * (22 - 9) - 20) / 4 = 8",
481
+ "(4 * 22 + 20) / 9 - 4 = 8",
482
+ "(4 * 22 + 20) / 9 - 4 = 8",
483
+ "(4 * 22 + 4 - 20) / 9 = 8",
484
+ "(4 * 22 + 4 - 20) / 9 = 8",
485
+ "(4 * 22 - 20 + 4) / 9 = 8",
486
+ "(4 * 22 - 20 + 4) / 9 = 8",
487
+ "(4 * 22 - 20 - 4) / 9 = 8",
488
+ "(4 * 22 - 20 - 4) / 9 = 8",
489
+ "(4 * 22 - 20) / 4 - 9 = 8",
490
+ "(4 * 22 - 20) / 4 - 9 = 8",
491
+ "(4 + 22 * 4 - 20) / 9 = 8",
492
+ "(4 + 22 * 4 - 20) / 9 = 8",
493
+ "(4 + 22 * 4 - 20) / 9 = 8",
494
+ "(4 + 22 * 4 - 20) / 9 = 8",
495
+ "(4 + 4 * 22 - 20) / 9 = 8",
496
+ "(4 + 4 * 22 - 20) / 9 = 8",
497
+ "(4 + 4 * 22 - 20) / 9 = 8",
498
+ "(4 + 4 * 22 - 20) / 9 = 8",
499
+ "(4 - 22 / (20 - 9)) * 4 = 8",
500
+ "(4 - 22 / (20 - 9)) * 4 = 8",
501
+ "20 + 4 / 4 + 9 - 22 = 8",
502
+ "20 + 4 / 4 + 9 - 22 = 8",
503
+ "20 + 4 / 4 + 9 - 22 = 8",
504
+ "20 + 4 / 4 + 9 - 22 = 8",
505
+ "20 + 4 / 4 - 22 - 9 = 8",
506
+ "20 + 4 / 4 - 22 - 9 = 8",
507
+ "20 + 9 + 4 / 4 - 22 = 8",
508
+ "20 + 9 + 4 / 4 - 22 = 8",
509
+ "20 + 9 + 4 / 4 - 22 = 8",
510
+ "20 + 9 + 4 / 4 - 22 = 8",
511
+ "20 + 9 - 22 + 4 / 4 = 8",
512
+ "20 + 9 - 22 + 4 / 4 = 8",
513
+ "20 + 9 - 22 - 4 / 4 = 8",
514
+ "20 + 9 - 22 - 4 / 4 = 8",
515
+ "20 - 22 - 4 / 4 + 9 = 8",
516
+ "20 - 22 - 4 / 4 + 9 = 8",
517
+ "20 - 22 - 4 / 4 - 9 = 8",
518
+ "20 - 22 - 4 / 4 - 9 = 8",
519
+ "20 - 22 - 9 + 4 / 4 = 8",
520
+ "20 - 22 - 9 + 4 / 4 = 8",
521
+ "20 - 22 - 9 + 4 / 4 = 8",
522
+ "20 - 22 - 9 + 4 / 4 = 8",
523
+ "20 - 22 - 9 - 4 / 4 = 8",
524
+ "20 - 22 - 9 - 4 / 4 = 8",
525
+ "22 - (20 + 4 * 9) / 4 = 8",
526
+ "22 - (20 + 4 * 9) / 4 = 8",
527
+ "22 - (20 + 9 * 4) / 4 = 8",
528
+ "22 - (20 + 9 * 4) / 4 = 8",
529
+ "22 - (4 * 9 + 20) / 4 = 8",
530
+ "22 - (4 * 9 + 20) / 4 = 8",
531
+ "22 - (9 * 4 + 20) / 4 = 8",
532
+ "22 - (9 * 4 + 20) / 4 = 8",
533
+ "4 * (20 - 9) * 4 / 22 = 8",
534
+ "4 * (20 - 9) * 4 / 22 = 8",
535
+ "4 * (20 - 9) * 4 / 22 = 8",
536
+ "4 * (20 - 9) * 4 / 22 = 8",
537
+ "4 * (20 - 9) * 4 / 22 = 8",
538
+ "4 * (20 - 9) * 4 / 22 = 8",
539
+ "4 * (20 - 9) / 22 * 4 = 8",
540
+ "4 * (20 - 9) / 22 * 4 = 8",
541
+ "4 * (4 - 22 / (20 - 9)) = 8",
542
+ "4 * (4 - 22 / (20 - 9)) = 8",
543
+ "4 * 4 * (20 - 9) / 22 = 8",
544
+ "4 * 4 * (20 - 9) / 22 = 8",
545
+ "4 * 4 * (20 - 9) / 22 = 8",
546
+ "4 * 4 * (20 - 9) / 22 = 8",
547
+ "4 * 4 * (20 - 9) / 22 = 8",
548
+ "4 * 4 * (20 - 9) / 22 = 8",
549
+ "4 * 4 / 22 / (20 - 9) = 8",
550
+ "4 * 4 / 22 / (20 - 9) = 8",
551
+ "4 * 4 / 22 / (20 - 9) = 8",
552
+ "4 * 4 / 22 / (20 - 9) = 8",
553
+ "4 / 22 / (20 - 9) * 4 = 8",
554
+ "4 / 22 / (20 - 9) * 4 = 8",
555
+ "4 / 4 + 20 + 9 - 22 = 8",
556
+ "4 / 4 + 20 + 9 - 22 = 8",
557
+ "4 / 4 + 20 + 9 - 22 = 8",
558
+ "4 / 4 + 20 + 9 - 22 = 8",
559
+ "4 / 4 + 20 + 9 - 22 = 8",
560
+ "4 / 4 + 20 + 9 - 22 = 8",
561
+ "4 / 4 + 20 - 22 - 9 = 8",
562
+ "4 / 4 + 20 - 22 - 9 = 8",
563
+ "4 / 4 + 20 - 22 - 9 = 8",
564
+ "4 / 4 + 20 - 22 - 9 = 8",
565
+ "4 / 4 + 9 + 20 - 22 = 8",
566
+ "4 / 4 + 9 + 20 - 22 = 8",
567
+ "4 / 4 + 9 + 20 - 22 = 8",
568
+ "4 / 4 + 9 + 20 - 22 = 8",
569
+ "4 / 4 + 9 + 20 - 22 = 8",
570
+ "4 / 4 + 9 + 20 - 22 = 8",
571
+ "4 / 4 + 9 - 22 - 20 = 8",
572
+ "4 / 4 + 9 - 22 - 20 = 8",
573
+ "4 / 4 + 9 - 22 - 20 = 8",
574
+ "4 / 4 + 9 - 22 - 20 = 8",
575
+ "9 * (20 - 4) / (22 - 4) = 8",
576
+ "9 * (20 - 4) / (22 - 4) = 8",
577
+ "9 + 20 + 4 / 4 - 22 = 8",
578
+ "9 + 20 + 4 / 4 - 22 = 8",
579
+ "9 + 20 + 4 / 4 - 22 = 8",
580
+ "9 + 20 + 4 / 4 - 22 = 8",
581
+ "9 + 20 - 22 + 4 / 4 = 8",
582
+ "9 + 20 - 22 + 4 / 4 = 8",
583
+ "9 + 20 - 22 - 4 / 4 = 8",
584
+ "9 + 20 - 22 - 4 / 4 = 8",
585
+ "9 + 4 / 4 + 20 - 22 = 8",
586
+ "9 + 4 / 4 + 20 - 22 = 8",
587
+ "9 + 4 / 4 + 20 - 22 = 8",
588
+ "9 + 4 / 4 + 20 - 22 = 8",
589
+ "9 + 4 / 4 - 22 - 20 = 8",
590
+ "9 + 4 / 4 - 22 - 20 = 8",
591
+ "9 - 22 - 20 + 4 / 4 = 8",
592
+ "9 - 22 - 20 + 4 / 4 = 8",
593
+ "9 - 22 - 20 + 4 / 4 = 8",
594
+ "9 - 22 - 20 + 4 / 4 = 8",
595
+ "9 - 22 - 20 - 4 / 4 = 8",
596
+ "9 - 22 - 20 - 4 / 4 = 8",
597
+ "9 - 22 - 4 / 4 + 20 = 8",
598
+ "9 - 22 - 4 / 4 + 20 = 8",
599
+ "9 - 22 - 4 / 4 - 20 = 8",
600
+ "9 - 22 - 4 / 4 - 20 = 8"
601
+ ]
602
+ end
603
+ end
metadata ADDED
@@ -0,0 +1,138 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rypto
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Joe Sortelli
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-04-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: minitest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '5.5'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '5.5'
55
+ - !ruby/object:Gem::Dependency
56
+ name: simplecov
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: yard
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: "\n A library that provides an API for solving hands from the Krypto\n
84
+ \ card game. See http://en.wikipedia.org/wiki/Krypto_%28game%29\n for a description
85
+ of Krypto.\n "
86
+ email:
87
+ - joe@sortelli.com
88
+ executables: []
89
+ extensions: []
90
+ extra_rdoc_files: []
91
+ files:
92
+ - ".gitignore"
93
+ - ".ruby-gemset"
94
+ - ".ruby-version"
95
+ - ".travis.yml"
96
+ - Gemfile
97
+ - LICENSE.txt
98
+ - README.md
99
+ - Rakefile
100
+ - lib/rypto.rb
101
+ - lib/rypto/brute_force_solver.rb
102
+ - lib/rypto/solution.rb
103
+ - lib/rypto/version.rb
104
+ - rypto.gemspec
105
+ - test/test_deck.rb
106
+ - test/test_hand.rb
107
+ - test/test_helper.rb
108
+ - test/test_solver.rb
109
+ homepage: https://github.com/sortelli/rypto
110
+ licenses:
111
+ - MIT
112
+ metadata: {}
113
+ post_install_message:
114
+ rdoc_options: []
115
+ require_paths:
116
+ - lib
117
+ required_ruby_version: !ruby/object:Gem::Requirement
118
+ requirements:
119
+ - - ">="
120
+ - !ruby/object:Gem::Version
121
+ version: '0'
122
+ required_rubygems_version: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - ">="
125
+ - !ruby/object:Gem::Version
126
+ version: '0'
127
+ requirements: []
128
+ rubyforge_project:
129
+ rubygems_version: 2.4.6
130
+ signing_key:
131
+ specification_version: 4
132
+ summary: Krypto card game solver.
133
+ test_files:
134
+ - test/test_deck.rb
135
+ - test/test_hand.rb
136
+ - test/test_helper.rb
137
+ - test/test_solver.rb
138
+ has_rdoc: